-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
42 lines (29 loc) · 1016 Bytes
/
Dockerfile
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
# syntax=docker/dockerfile:1.2
# Good base image to start from for most development
FROM node:20.10.0-slim
# Please remember, the base image we use /must be as small as possible/ for the best
# production deployments. This is not optional.
WORKDIR /workspace
# The official Debian/Ubuntu Docker Image automatically removes the cache by default!
# Removing the docker-clean file manages that issue.
RUN rm -rf /etc/apt/apt.conf.d/docker-clean
COPY ./bin/builds/ .
# Switch to non-root user
RUN mkdir /home/.npm
RUN useradd -m appuser && chown -R appuser /workspace && chown -R appuser "/home/.npm"
RUN --mount=type=cache,target=/var/cache/apt ./install_packages \
dumb-init \
htop \
make \
g++ \
python3
ENV PATH=/root/.local/bin:$PATH
COPY package-lock.json .
COPY package.json .
RUN --mount=type=cache,target=/root/.cache npm ci
USER appuser
# Copy project files
COPY . .
RUN npm run build
ENV NODE_ENV=production
ENTRYPOINT ["/usr/bin/dumb-init", "--", "npm", "run", "start:prod"]