From fe28520e4b6699b3941020388c85739aa33bf228 Mon Sep 17 00:00:00 2001 From: Siratee K Date: Sun, 14 May 2023 19:05:08 +0700 Subject: [PATCH] chore: Update the workflow and Dockerfile --- .github/workflows/build-and-release.yml | 7 +++++-- Dockerfile | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index c6133e0..1e87df8 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -61,8 +61,11 @@ jobs: - name: Mount a fake secret file run: | - echo FakeValue > src/firebaseConfig.json - echo FakeValue > src/GarnBarnApiConfig.json + echo $firebaseConfig > src/firebaseConfig.json + echo $config > src/GarnBarnApiConfig.json + env: + config: ${{ secrets.GARNBARN_FRONTEND_CONFIG }} + firebaseConfig: ${{ secrets.GARNBARN_FIREBASE_CONFIG }} # Setup BuildX - name: Set up Docker Buildx diff --git a/Dockerfile b/Dockerfile index 7c90942..e216b5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Builder -FROM node:12-alpine AS builder +## Builder Stage +FROM node:12-alpine AS build-stage WORKDIR /app @@ -13,6 +13,21 @@ RUN yarn install # copy project files and folders to the current working directory (i.e. 'app' folder) COPY . . -EXPOSE 8080 +# Build +RUN yarn run build -CMD ["yarn", "serve"] +# Remove sourcemap file before send output to production-stage +RUN find . -name "*.map" -type f -delete + + + +## Production Stage +FROM nginx:stable-alpine as production-stage + +COPY nginx.conf /etc/nginx/nginx.conf + +COPY --from=build-stage /app/dist /usr/share/nginx/html/ + + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"]