-
Notifications
You must be signed in to change notification settings - Fork 782
/
chronik.e.cash.Dockerfile
42 lines (34 loc) · 1.3 KB
/
chronik.e.cash.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
# Multi-stage
# 1) Node image for building frontend assets
# 2) nginx stage to serve frontend assets
# Stage 1
FROM node:20-bookworm-slim AS builder
# Build ecashaddrjs, local dependency of chronik-client
WORKDIR /app/modules/ecashaddrjs
COPY modules/ecashaddrjs/ .
RUN npm ci
RUN npm run build
# First, copy chronik-client and install its dependencies at the same relative path
WORKDIR /app/modules/chronik-client
COPY modules/chronik-client/ .
RUN npm ci
RUN npm run build
# Then, copy and build chronik.e.cash
WORKDIR /app/web/chronik.e.cash/
COPY web/chronik.e.cash/package.json .
COPY web/chronik.e.cash/package-lock.json .
RUN npm ci
# Copy everything in web/chronik.e.cash
COPY web/chronik.e.cash/ .
# If you do not have an .abclatestversion file, create one by copying .abclatestversion.sample
# Note, in CI, you must create .abclatestversion before running this Dockerfile
RUN if [ ! -f .abclatestversion ]; then mv .abclatestversion.sample .abclatestversion; fi
RUN npm run build
# Stage 2
FROM nginx
ARG NGINX_CONF=nginx.conf
COPY web/chronik.e.cash/$NGINX_CONF /etc/nginx/conf.d/default.conf
# Copy static assets from builder stage
COPY --from=builder /app/web/chronik.e.cash/build /usr/share/nginx/html/
# Containers run nginx with global directives and daemon off
ENTRYPOINT ["nginx", "-g", "daemon off;"]