]>
Commit | Line | Data |
---|---|---|
1 | # build stage | |
2 | FROM node:lts-alpine as build-stage | |
3 | ||
4 | WORKDIR /app | |
5 | ||
6 | COPY package*.json ./ | |
7 | RUN yarn install --frozen-lockfile | |
8 | ||
9 | COPY . . | |
10 | RUN yarn build | |
11 | ||
12 | # production stage | |
13 | FROM alpine:3.18 | |
14 | ||
15 | ENV GID 1000 | |
16 | ENV UID 1000 | |
17 | ENV PORT 8080 | |
18 | ENV SUBFOLDER "/_" | |
19 | ENV INIT_ASSETS 1 | |
20 | ENV IPV6_DISABLE 0 | |
21 | ||
22 | RUN addgroup -S lighttpd -g ${GID} && adduser -D -S -u ${UID} lighttpd lighttpd && \ | |
23 | apk add -U --no-cache lighttpd | |
24 | ||
25 | WORKDIR /www | |
26 | ||
27 | COPY lighttpd.conf /lighttpd.conf | |
28 | COPY lighttpd-ipv6.sh /etc/lighttpd/ipv6.sh | |
29 | COPY entrypoint.sh /entrypoint.sh | |
30 | COPY --from=build-stage --chown=${UID}:${GID} /app/dist /www/ | |
31 | COPY --from=build-stage --chown=${UID}:${GID} /app/dist/assets /www/default-assets | |
32 | ||
33 | USER ${UID}:${GID} | |
34 | ||
35 | HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ | |
36 | CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1 | |
37 | ||
38 | EXPOSE ${PORT} | |
39 | ||
40 | ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] |