-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 804 Bytes
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 804 Bytes
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
ARG NODE_VERSION=22
#
# Base image
#
FROM node:${NODE_VERSION}-trixie-slim AS base
ARG DOCKER_USER=bob
ARG DOCKER_GROUP=bob
# Rename node user and group
RUN usermod -l ${DOCKER_USER} node && \
groupmod -n ${DOCKER_GROUP} node && \
mv /home/node /home/${DOCKER_USER} && \
usermod -d /home/${DOCKER_USER} ${DOCKER_USER}
# Create app directory
RUN mkdir /app && \
chown -R ${DOCKER_USER}:${DOCKER_GROUP} /app
# Set working directory
WORKDIR /app
# Run as normal user
USER ${DOCKER_USER}
#
# Dev image
#
FROM base AS dev
# Add fix-perm.sh script to image
USER 0
COPY ./fix-perm.sh /fix-perm.sh
RUN chmod +x /fix-perm.sh
USER ${DOCKER_USER}
# Set entrypoint so the container will run without doing anything
ENTRYPOINT ["/bin/sleep", "infinity"]
#
# Dist image
#
FROM base AS dist