-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.ember
61 lines (52 loc) · 1.84 KB
/
Dockerfile.ember
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
FROM danlynn/ember-cli:4.12.1 AS build
# Copy pnpm relevant files from all apps in workspace
COPY package.json pnpm-*.yaml /myapp/
COPY ember-caluma-portal/package.json /myapp/ember-caluma-portal/
COPY ember-camac-ng/package.json /myapp/ember-camac-ng/
COPY ember-ebau/package.json /myapp/ember-ebau/
COPY ember-ebau-core/package.json /myapp/ember-ebau-core/
# Fetch all workspace dependencies
RUN --mount=type=cache,target=.pnpm-store,sharing=locked \
corepack enable && \
pnpm config set store-dir .pnpm-store && \
pnpm fetch
COPY . /myapp/
# Install dependencies, this should not need to fetch any dependencies as they
# are fetched into the pnpm store beforehand
RUN pnpm install --recursive --frozen-lockfile
ARG APP_ENV=production
ARG APPLICATION
ARG BE_GIS_URL
ARG EGOV_PORTAL_URL
ARG EGOV_PRESTATION_PATH
ARG ENABLE_TOKEN_EXCHANGE
ARG ENABLE_WATERMARK
ARG INTERNAL_URL
ARG KEYCLOAK_HOST
ARG KEYCLOAK_REALM
ARG PORTAL_URL
ARG SO_GIS_URL
ARG WATERMARK
ARG WORKSPACE
ARG ALEXANDRIA_MANABI_ALLOWED_MIMETYPES
ARG GIS_HOST
ARG LOCALES
WORKDIR /myapp/$WORKSPACE
RUN pnpm build
# Production environment
FROM nginxinc/nginx-unprivileged:1.27-alpine AS prod
ARG WORKSPACE
COPY --from=build /myapp/$WORKSPACE/dist /usr/share/nginx/html
COPY nginx/ember.conf /etc/nginx/conf.d/default.conf
# Production environment with runtime environment variables (currently only used in SO & BE)
FROM nginxinc/nginx-unprivileged:1.27-alpine AS prod-env
ARG WORKSPACE
ARG REPLACE_ENV
ENV REPLACE_ENV_RUNTIME=$REPLACE_ENV
USER root
RUN chown -R nginx:nginx /usr/share/nginx/html
USER nginx
COPY --from=build --chown=nginx:nginx /myapp/$WORKSPACE/dist /usr/share/nginx/html
COPY nginx/ember.conf /etc/nginx/conf.d/default.conf
COPY nginx/replace-env-vars.sh /usr/local/bin/replace-env-vars
CMD /bin/sh -c "replace-env-vars $REPLACE_ENV_RUNTIME /usr/share/nginx/html && nginx -g 'daemon off;'"