-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathDockerfile.deb
More file actions
104 lines (74 loc) · 2.06 KB
/
Dockerfile.deb
File metadata and controls
104 lines (74 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
ARG BUILD_IMAGE=node:22-slim
ARG SERVE_IMAGE=python:3.11-slim
# Set Production Build Flag
ARG PROD_BUILD=true
# Set Default Port
ARG PORT=8080
FROM $BUILD_IMAGE AS builder
# Production Build Flag
ARG PROD_BUILD
# Set Debian Frontend Flag
ARG DEBIAN_FRONTEND=noninteractive
# Disable NPM Update Notifications
ENV NPM_CONFIG_UPDATE_NOTIFIER=false
# Set the Working Directory
WORKDIR /tmp
# Copy UI Code
COPY ./ui/. ./
# Install UI Dependencies
RUN if [ "${PROD_BUILD}" = true ]; then \
npm ci; \
else \
npm install; \
fi
RUN chmod 777 -R node_modules
# Build IPAM UI
RUN npm run build
FROM $SERVE_IMAGE
# Set Production Build Flag
ARG PROD_BUILD
# Port to Listen On
ARG PORT
# Set Debian Frontend to Non-Interactive
ARG DEBIAN_FRONTEND=noninteractive
# Set Environment Variable
ENV PORT=${PORT}
# Disable PIP Root Warnings
ENV PIP_ROOT_USER_ACTION=ignore
# Set Working Directory
WORKDIR /tmp
# Install OpenSSH and set the password for root to "Docker!"
RUN apt-get update
RUN apt-get install -qq openssh-server -y \
&& echo "root:Docker!" | chpasswd
# Enable SSH root login with Password Authentication
# RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
# Copy 'sshd_config File' to /etc/ssh/
COPY sshd_config /etc/ssh/
# Set SSH Key Permissions
RUN ssh-keygen -A
RUN mkdir -p /var/run/sshd
# Set Working Directory
WORKDIR /ipam
# Install Engine Dependencies
COPY ./engine/requirements.txt /code/requirements.txt
COPY ./engine/requirements.lock.txt /code/requirements.lock.txt
# Upgrade PIP
RUN pip install --upgrade pip --progress-bar off
# Install Dependencies
RUN if [ "${PROD_BUILD}" = true ]; then \
pip install --no-cache-dir -r /code/requirements.lock.txt --progress-bar off; \
else \
pip install --no-cache-dir -r /code/requirements.txt --progress-bar off; \
fi
# Copy Engine Code
COPY ./engine/app ./app
COPY --from=builder /tmp/dist ./dist
# Copy Init Script
COPY ./init.sh .
# Set Script Execute Permissions
RUN chmod +x init.sh
# Expose Ports
EXPOSE $PORT 2222
# Execute Startup Script
ENTRYPOINT ./init.sh ${PORT}