generated from pascaliske/docker-package
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (40 loc) · 1.24 KB
/
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
50
51
52
53
54
55
# --- dependencies image
FROM --platform=${BUILDPLATFORM} node:22-alpine AS dependencies
LABEL maintainer="[email protected]"
WORKDIR /build
# copy sources
COPY package.json /build
COPY yarn.lock /build
# install dependencies
RUN yarn install --frozen-lockfile --ignore-scripts
# builder image
FROM --platform=${BUILDPLATFORM} node:22-alpine AS builder
LABEL maintainer="[email protected]"
WORKDIR /build
# copy dependencies
COPY --from=dependencies /build/node_modules /build/node_modules
# copy sources
COPY . /build
# build & prerender
RUN yarn run build
# --- final image
FROM nginx:1.27.3-alpine
LABEL maintainer="[email protected]"
# environment
ENV NGINX_PORT=8080
# remove default pages
RUN rm -rf /usr/share/nginx/html/*
# copy entrypoint & nginx
COPY ./docker-entrypoint.sh /entrypoint.sh
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
# copy built app
COPY --from=builder /build/dist/docker-traefik-errors/browser /usr/share/nginx/html
# expose port
EXPOSE ${NGINX_PORT}
# expose access logs
VOLUME /var/log/nginx
# health check of error pages
HEALTHCHECK CMD wget --no-verbose --tries=1 --spider http://localhost:${NGINX_PORT} || exit 1
# define entrypoint & command
ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]