Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (30 loc) · 1.5 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (30 loc) · 1.5 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
#################################################################################
# Generate htpasswd file
#################################################################################
# FROM appsoa/docker-alpine-htpasswd as htpasswd
# ARG BASIC_AUTH_USER=gfw
# ARG BASIC_AUTH_PASS=default
# ENV BASIC_AUTH_USER $BASIC_AUTH_USER
# ENV BASIC_AUTH_PASS $BASIC_AUTH_PASS
# RUN htpasswd -Bbn "$BASIC_AUTH_USER" "$BASIC_AUTH_PASS" > /home/.htpasswd
FROM us-central1-docker.pkg.dev/gfw-int-infrastructure/frontend/dependencies:latest AS builder
WORKDIR /app
ENV NODE_ENV=production
ARG VITE_API_GATEWAY
ENV VITE_API_GATEWAY=$VITE_API_GATEWAY
COPY . .
RUN pnpm install --frozen-lockfile && \
pnpm exec nx run user-groups-admin:build
#################################################################################
# Actual application to run
#################################################################################
# Using stable version that uses alpine 3.14 to fix build errors
# https://github.com/alpinelinux/docker-alpine/issues/182
FROM nginx:stable-alpine AS production
RUN apk update && apk upgrade libxml2 libexpat
COPY --from=builder /app/dist/apps/user-groups-admin/nginx.conf /etc/nginx/nginx.template
# COPY --from=htpasswd /home/.htpasswd /home/.htpasswd
# RUN cat /home/.htpasswd >> /etc/nginx/.htpasswd
COPY --from=builder /app/dist/apps/user-groups-admin/config/entrypoint.sh ./entrypoint.sh
COPY --from=builder /app/dist/apps/user-groups-admin/ /usr/share/nginx/www/
ENTRYPOINT ["./entrypoint.sh"]