Update Dockerfile
Browse files- Dockerfile +16 -5
Dockerfile
CHANGED
|
@@ -1,24 +1,35 @@
|
|
| 1 |
FROM node:18-alpine
|
| 2 |
|
| 3 |
-
# Install
|
| 4 |
RUN apk add --no-cache \
|
| 5 |
python3 \
|
| 6 |
py3-pip \
|
| 7 |
git \
|
| 8 |
curl \
|
| 9 |
bash \
|
| 10 |
-
coreutils
|
|
|
|
| 11 |
|
| 12 |
WORKDIR /app
|
| 13 |
|
|
|
|
| 14 |
COPY package*.json ./
|
| 15 |
RUN npm install
|
| 16 |
|
|
|
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
|
|
|
| 21 |
RUN addgroup -S sandbox && adduser -S sandbox -G sandbox
|
| 22 |
-
USER sandbox
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM node:18-alpine
|
| 2 |
|
| 3 |
+
# Install dependencies including Nginx for multi-port proxying
|
| 4 |
RUN apk add --no-cache \
|
| 5 |
python3 \
|
| 6 |
py3-pip \
|
| 7 |
git \
|
| 8 |
curl \
|
| 9 |
bash \
|
| 10 |
+
coreutils \
|
| 11 |
+
nginx
|
| 12 |
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
+
# Copy package files
|
| 16 |
COPY package*.json ./
|
| 17 |
RUN npm install
|
| 18 |
|
| 19 |
+
# Copy application files
|
| 20 |
COPY . .
|
| 21 |
|
| 22 |
+
# Setup Nginx configuration
|
| 23 |
+
COPY nginx.conf /etc/nginx/http.d/default.conf
|
| 24 |
|
| 25 |
+
# Create sandbox user
|
| 26 |
RUN addgroup -S sandbox && adduser -S sandbox -G sandbox
|
|
|
|
| 27 |
|
| 28 |
+
# Create necessary directories
|
| 29 |
+
RUN mkdir -p /var/log/nginx /var/lib/nginx/tmp && \
|
| 30 |
+
chown -R sandbox:sandbox /var/log/nginx /var/lib/nginx /tmp/sandboxes
|
| 31 |
+
|
| 32 |
+
EXPOSE 7860
|
| 33 |
+
|
| 34 |
+
# Start both Nginx and Node.js server
|
| 35 |
+
CMD sh -c "nginx && su sandbox -c 'node server.js'"
|