-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
98 lines (87 loc) · 3.25 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# syntax=docker/dockerfile:1
ARG NODE_VERSION=20.17.0
FROM node:${NODE_VERSION}-alpine as base
# Build Config.
ARG APP_PATH=/app \
PNPM_STORE_DIR="/data/pnpm-store"
ENV APP_PATH=${APP_PATH} \
PNPM_STORE_DIR=${PNPM_STORE_DIR}
# App Config.
ARG CI=1 \
VITE_APP_API_BASE_URL \
VITE_APP_BASE_URL \
VITE_APP_WS_URL \
VITE_APP_STAGE=production \
VITE_APP_AWS_CCP_URL \
VITE_APP_CCP_INSTANCE \
VITE_APP_PORTAL_KEY=crisiscleanup_us
ENV CI=${CI} \
VITE_APP_API_BASE_URL=${VITE_APP_API_BASE_URL} \
VITE_APP_BASE_URL=${VITE_APP_BASE_URL} \
VITE_APP_WS_URL=${VITE_APP_WS_URL} \
VITE_APP_STAGE=${VITE_APP_STAGE} \
VITE_APP_AWS_CCP_URL=${VITE_APP_AWS_CCP_URL} \
VITE_APP_CCP_INSTANCE=${VITE_APP_CCP_INSTANCE} \
VITE_APP_PORTAL_KEY=${VITE_APP_PORTAL_KEY} \
CYPRESS_INSTALL_BINARY=0
# Common deps.
RUN apk add --no-cache \
git \
curl
# Builder
FROM base as builder
ARG TARGETPLATFORM
ARG PNPM_VERSION=9.9.0
RUN corepack enable pnpm \
&& corepack prepare pnpm@${PNPM_VERSION} --activate
WORKDIR ${APP_PATH}
COPY pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm-store-${TARGETPLATFORM},target=${PNPM_STORE_DIR} \
pnpm config -g set store-dir ${PNPM_STORE_DIR}
RUN --mount=type=cache,id=pnpm-store-${TARGETPLATFORM},target=${PNPM_STORE_DIR} \
pnpm fetch
# Build dist.
FROM builder as dist
WORKDIR ${APP_PATH}
ARG VITE_APP_WHAT_3_WORDS_API_KEY \
VITE_APP_GOOGLE_MAPS_API_KEY \
VITE_APP_PITNEYBOWES_API_KEY \
VITE_APP_PITNEYBOWES_BASIC_AUTH_TOKEN \
VITE_APP_PHONE_DEFAULT_USERNAME \
VITE_APP_PHONE_DEFAULT_PASSWORD \
VITE_APP_ENGLISH_PHONE_GATEWAY \
VITE_APP_SPANISH_PHONE_GATEWAY \
VITE_APP_DEFAULT_CALLER_ID \
VITE_APP_PHONE_DOCTOR_NUMBER \
VITE_APP_CRISISCLEANUP_WEB_CLIENT_ID \
SENTRY_DSN \
SENTRY_AUTH_TOKEN \
SENTRY_PROPERTIES="sentry.properties"
COPY --link package.json ./
RUN --mount=type=cache,id=pnpm-store-${TARGETPLATFORM},target=${PNPM_STORE_DIR} \
pnpm install --offline
COPY --link . ./
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
RUN --mount=type=cache,id=pnpm-store-${TARGETPLATFORM},target=${PNPM_STORE_DIR} \
VITE_APP_WHAT_3_WORDS_API_KEY=${VITE_APP_WHAT_3_WORDS_API_KEY} \
VITE_APP_GOOGLE_MAPS_API_KEY=${VITE_APP_GOOGLE_MAPS_API_KEY} \
VITE_APP_PITNEYBOWES_API_KEY=${VITE_APP_PITNEYBOWES_API_KEY} \
VITE_APP_PITNEYBOWES_BASIC_AUTH_TOKEN=${VITE_APP_PITNEYBOWES_BASIC_AUTH_TOKEN} \
VITE_APP_PHONE_DEFAULT_USERNAME=${VITE_APP_PHONE_DEFAULT_USERNAME} \
VITE_APP_PHONE_DEFAULT_PASSWORD=${VITE_APP_PHONE_DEFAULT_PASSWORD} \
VITE_APP_ENGLISH_PHONE_GATEWAY=${VITE_APP_ENGLISH_PHONE_GATEWAY} \
VITE_APP_SPANISH_PHONE_GATEWAY=${VITE_APP_SPANISH_PHONE_GATEWAY} \
VITE_APP_DEFAULT_CALLER_ID=${VITE_APP_DEFAULT_CALLER_ID} \
VITE_APP_PHONE_DOCTOR_NUMBER=${VITE_APP_PHONE_DOCTOR_NUMBER} \
VITE_APP_CRISISCLEANUP_WEB_CLIENT_ID=${VITE_APP_CRISISCLEANUP_WEB_CLIENT_ID} \
SENTRY_DSN=${SENTRY_DSN} \
SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} \
SENTRY_PROPERTIES=${SENTRY_PROPERTIES} \
pnpm build:app --mode=${VITE_APP_STAGE}
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=dist /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]