Update Dockerfile
Browse files- Dockerfile +12 -32
Dockerfile
CHANGED
|
@@ -1,43 +1,23 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
-
# Install
|
| 4 |
-
RUN
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
iproute2 \
|
| 8 |
git \
|
| 9 |
-
|
| 10 |
-
ca-certificates \
|
| 11 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
# Install gVisor runsc
|
| 14 |
-
RUN curl -fsSL https://storage.googleapis.com/gvisor/releases/release/latest/x86_64/runsc \
|
| 15 |
-
-o /usr/local/bin/runsc && \
|
| 16 |
-
chmod +x /usr/local/bin/runsc
|
| 17 |
-
|
| 18 |
-
RUN curl -fsSL https://storage.googleapis.com/gvisor/releases/release/latest/x86_64/containerd-shim-runsc-v1 \
|
| 19 |
-
-o /usr/local/bin/containerd-shim-runsc-v1 && \
|
| 20 |
-
chmod +x /usr/local/bin/containerd-shim-runsc-v1
|
| 21 |
-
|
| 22 |
-
# Install Docker
|
| 23 |
-
RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
|
| 24 |
-
sh get-docker.sh && \
|
| 25 |
-
rm get-docker.sh
|
| 26 |
-
|
| 27 |
-
# Configure Docker to use runsc runtime
|
| 28 |
-
RUN mkdir -p /etc/docker && \
|
| 29 |
-
echo '{"runtimes":{"runsc":{"path":"/usr/local/bin/runsc","runtimeArgs":["--net-raw"]}}}' > /etc/docker/daemon.json
|
| 30 |
-
|
| 31 |
-
# Install Node.js
|
| 32 |
-
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
| 33 |
-
apt-get install -y nodejs
|
| 34 |
-
|
| 35 |
-
# Copy application
|
| 36 |
WORKDIR /app
|
|
|
|
| 37 |
COPY package*.json ./
|
| 38 |
RUN npm install
|
|
|
|
| 39 |
COPY . .
|
| 40 |
|
| 41 |
EXPOSE 3001
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
CMD ["node", "server.js"]
|
|
|
|
| 1 |
+
FROM node:18-alpine
|
| 2 |
|
| 3 |
+
# Install common tools
|
| 4 |
+
RUN apk add --no-cache \
|
| 5 |
+
python3 \
|
| 6 |
+
py3-pip \
|
|
|
|
| 7 |
git \
|
| 8 |
+
curl
|
|
|
|
|
|
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
WORKDIR /app
|
| 11 |
+
|
| 12 |
COPY package*.json ./
|
| 13 |
RUN npm install
|
| 14 |
+
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
EXPOSE 3001
|
| 18 |
|
| 19 |
+
# Run as non-root
|
| 20 |
+
RUN addgroup -S sandbox && adduser -S sandbox -G sandbox
|
| 21 |
+
USER sandbox
|
| 22 |
+
|
| 23 |
CMD ["node", "server.js"]
|