-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (31 loc) · 982 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
43
44
45
46
47
48
49
ARG NODE_VERSION=18.13.0
ARG ALPINE_VERSION=3.17
ARG NGINX_VERSION=1.22.1
## Development image
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS development
WORKDIR /usr/src/app
ENV PROMPT="%B%F{cyan}%n%f@%m:%F{yellow}%~%f %F{%(?.green.red[%?] )}>%f %b"
ENV PATH="${PATH}:/app/node_modules/.bin"
ARG USER_ID=1000
RUN apk add \
zsh
RUN if [ $USER_ID -ne 1000 ]; then \
apk add --no-cache -t tmp shadow \
&& groupmod -g $USER_ID node \
&& usermod -u $USER_ID -g $USER_ID node \
&& apk del --purge tmp; \
fi
USER node
## Builder image
FROM development AS builder
ENV NODE_ENV production
ENV SASS_PATH=node_modules:src
COPY . .
RUN npm ci \
&& npm run build
## Runtime image
FROM nginx:${NGINX_VERSION}-alpine AS runtime
WORKDIR /usr/share/nginx/html
COPY deployments/containers/nginx/nginx.conf /etc/nginx/nginx.conf
COPY deployments/containers/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/build .