forked from pk910/PoWFaucet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (42 loc) · 1.48 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (42 loc) · 1.48 KB
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
# build-server env
FROM --platform=$BUILDPLATFORM node:22-slim AS build-server-env
WORKDIR /build
COPY package*.json ./
RUN npm install
COPY ./libs libs
COPY ./tsconfig.json .
COPY ./webpack.config.js .
COPY ./src src
RUN npm run bundle
# build-client env
FROM --platform=$BUILDPLATFORM node:22-slim AS build-client-env
WORKDIR /build
COPY faucet-client/package*.json ./faucet-client/
COPY ./libs libs
COPY ./static static
RUN cd faucet-client && npm install
COPY ./faucet-client faucet-client
RUN cd faucet-client && node ./build-client.js
# final stage
FROM nginxinc/nginx-unprivileged:1.27
USER root
# Copy node binary from official image and install ca-certificates
COPY --from=node:22-slim /usr/local/bin/node /usr/local/bin/node
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates
WORKDIR /app
COPY --from=build-server-env /build/bundle ./bundle
COPY --from=build-client-env /build/static ./static
COPY ./faucet-config.example.yaml .
RUN cp ./static/index.html ./static/index.seo.html \
&& chmod 777 ./static/index.seo.html
# Writable data directory for config, database, and other runtime files
RUN mkdir -p /data && chmod 777 /data
# nginx config: serves static files directly, proxies /api/ and /ws/ to node backend
COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY --chmod=755 ./docker/entrypoint.sh /entrypoint.sh
USER nginx
WORKDIR /data
EXPOSE 8080
ENTRYPOINT [ "/entrypoint.sh" ]