Skip to content

Commit 2f58e53

Browse files
committed
Update documentation and rename script names
- Update docker syntax version - Copy only files needed for yarn install
1 parent 98b3641 commit 2f58e53

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

app/env.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { defineConfig, Schema } from '@julr/vite-plugin-validate-env';
33
export default defineConfig({
44
APP_TITLE: Schema.string(),
55
APP_ENVIRONMENT: (key, value) => {
6+
// NOTE: APP_ENVIRONMENT_PLACEHOLDER is meant to be used with image builds
7+
// The value will be later replaced with the actual value
68
const regex = /^production|staging|testing|alpha-\d+|development|APP_ENVIRONMENT_PLACEHOLDER$/;
79
const valid = !!value && (value.match(regex) !== null);
810
if (!valid) {

collaborating/repository-structure.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,9 @@ The `packages/go-ui-storybook` directory contains the stories for the IFRC GO UI
4747

4848
- **`src/stories/`**: Houses all the UI component stories.
4949
- **`.storybook/`**: Contains the configuration for Storybook.
50+
51+
### `nginx-serve` Directory
52+
53+
The `nginx-serve` directory contains nginx config and helm charts to run the web application.
54+
55+
> NOTE: We need to add more information later.

nginx-serve/Dockerfile

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# syntax=docker/dockerfile:1-labs
2+
13
FROM node:18-bullseye AS runtime
24

35
RUN apt-get update -y \
@@ -12,11 +14,8 @@ RUN git config --global --add safe.directory /code
1214
# ------------------------------------------------------------------------------------
1315
FROM 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

2120
RUN 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
3736
ARG APP_SENTRY_REPLAYS_ON_ERROR_SAMPLE_RATE=
3837
ENV 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
# ------------------------------------------------------------------------------------
4644
FROM nginx:1 AS nginx-serve
4745

4846
LABEL maintainer="IFRC"
4947
LABEL 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/
5250
COPY ./nginx-serve/nginx.conf.template /etc/nginx/templates/default.conf.template
5351
COPY --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

nginx-serve/apply-helm-config.sh renamed to nginx-serve/apply-config.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash -xe
22

3-
SOURCE_DIRECTORY=${SOURCE_DIRECTORY?Required}
4-
DESTINATION_DIRECTORY=${DESTINATION_DIRECTORY?Required}
3+
SOURCE_DIRECTORY=${APPLY_CONFIG__SOURCE_DIRECTORY?Required}
4+
DESTINATION_DIRECTORY=${APPLY_CONFIG__DESTINATION_DIRECTORY?Required}
55

66
# Parse arguments for --overwrite option
7-
OVERWRITE_DESTINATION=${OVERWRITE_DESTINATION:-false}
7+
OVERWRITE_DESTINATION=${APPLY_CONFIG__OVERWRITE_DESTINATION:-false}
88
for arg in "$@"; do
99
if [[ "$arg" == "--overwrite" ]]; then
1010
OVERWRITE_DESTINATION=true

0 commit comments

Comments
 (0)