1+ # syntax=docker/dockerfile:1-labs
2+
13FROM node:18-bullseye AS runtime
24
35RUN apt-get update -y \
@@ -12,11 +14,8 @@ RUN git config --global --add safe.directory /code
1214# ------------------------------------------------------------------------------------
1315FROM runtime AS nginx-build
1416
15- # TODO: Add cache with packages.json
16- # This is not working, will need @samshara help to configure this
17- # COPY package.json yarn.lock /code/
18- # COPY app/package.json /code/app/
19- COPY . /code
17+ # NOTE: --parents is not yet available in stable syntax, using docker/dockerfile:1-labs
18+ COPY --parents package.json yarn.lock ./**/package.json /code/
2019
2120RUN yarn install --frozen-lockfile --network-concurrency 2
2221
@@ -37,21 +36,21 @@ ENV APP_SENTRY_REPLAYS_SESSION_SAMPLE_RATE=${APP_SENTRY_REPLAYS_SESSION_SAMPLE_R
3736ARG APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE=
3837ENV APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE=${APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE}
3938
39+ COPY . /code/
4040
41- RUN yarn build \
42- && cd app \
43- && yarn build
41+ RUN yarn build
4442
4543# ------------------------------------------------------------------------------------
4644FROM nginx:1 AS nginx-serve
4745
4846LABEL maintainer="IFRC"
4947LABEL org.opencontainers.image.source="https://github.com/IFRCGo/go-web-app"
5048
51- COPY ./nginx-serve/apply-helm- config.sh /docker-entrypoint.d/
49+ COPY ./nginx-serve/apply-config.sh /docker-entrypoint.d/
5250COPY ./nginx-serve/nginx.conf.template /etc/nginx/templates/default.conf.template
5351COPY --from=nginx-build /code/build /code/build
5452
55- ENV SOURCE_DIRECTORY=/code/build/
56- ENV DESTINATION_DIRECTORY=/usr/share/nginx/html/
57- ENV OVERWRITE_DESTINATION=true
53+ # NOTE: Used by apply-config.sh
54+ ENV APPLY_CONFIG__SOURCE_DIRECTORY=/code/build/
55+ ENV APPLY_CONFIG__DESTINATION_DIRECTORY=/usr/share/nginx/html/
56+ ENV APPLY_CONFIG__OVERWRITE_DESTINATION=true
0 commit comments