-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.govtool
52 lines (35 loc) · 1.32 KB
/
Dockerfile.govtool
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
FROM node:22-alpine AS base
RUN apk add --no-cache git bash
ARG CARDANO_NETWORK=preview
ENV CARDANO_NETWORK=${CARDANO_NETWORK}
WORKDIR /app
RUN git clone https://github.com/IntersectMBO/govtool.git /app
WORKDIR /app/govtool/frontend
RUN yarn install
COPY ./ui/dist /app/govtool/frontend/ui/dist
# Conditionally install the package or copy UI files
RUN if [ "$CARDANO_NETWORK" = "mainnet" ]; then \
echo "Installing latest @intersect.mbo/govtool-outcomes-pillar-ui via yarn..."; \
yarn cache clean; \
yarn add @intersect.mbo/govtool-outcomes-pillar-ui@latest; \
else \
echo "Copying UI files for non-mainnet environment..."; \
cp -r /app/govtool/frontend/ui/dist /app/govtool/frontend/node_modules/@intersect.mbo/govtool-outcomes-pillar-ui/dist; \
fi
# Copy environment variables and build the project
RUN cp .env.example .env
RUN if [ "$CARDANO_NETWORK" = "mainnet" ]; then \
sed -i 's/^VITE_NETWORK_FLAG=.*/VITE_NETWORK_FLAG=1/' .env; \
else \
sed -i 's/^VITE_NETWORK_FLAG=.*/VITE_NETWORK_FLAG=0/' .env; \
fi
RUN yarn build
# ---- Production Stage ----
FROM node:22-alpine AS production
# Set working directory
WORKDIR /app
RUN npm install -g serve
# Copy built frontend from base stage
COPY --from=base /app/govtool/frontend/dist /app/public
EXPOSE 80
CMD ["serve", "-s", "public", "-l", "80"]