From b73eae47b1d4fd3406a608c2a148d4937827e568 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 30 Sep 2023 13:50:46 -0400 Subject: [PATCH] remove staging dockerfile, add configureation steps to workflows --- .github/workflows/build-gcp-image.yaml | 10 ++++++++++ .github/workflows/build-ghcr-image.yaml | 16 ++++++++++++++++ .github/workflows/deploy-dev.yaml | 6 +++--- .github/workflows/deploy-prod.yaml | 10 ++++++---- Dockerfile.staging | 17 ----------------- .env.production => config/.env.production | 0 .env.staging => config/.env.staging | 0 src/features/Resume/Resume.tsx | 1 - 8 files changed, 35 insertions(+), 25 deletions(-) delete mode 100644 Dockerfile.staging rename .env.production => config/.env.production (100%) rename .env.staging => config/.env.staging (100%) diff --git a/.github/workflows/build-gcp-image.yaml b/.github/workflows/build-gcp-image.yaml index 16f3f97..7c80e76 100644 --- a/.github/workflows/build-gcp-image.yaml +++ b/.github/workflows/build-gcp-image.yaml @@ -41,6 +41,16 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Configure Dev image + if: ${{ inputs.environment == 'development' }} + run: | + cp config/.env.staging .env + + - name: Configure Prod image + if: ${{ inputs.environment == 'production' }} + run: | + cp config/.env.production .env + - name: Docker meta uses: docker/metadata-action@v4 id: meta diff --git a/.github/workflows/build-ghcr-image.yaml b/.github/workflows/build-ghcr-image.yaml index fd82e42..693f607 100644 --- a/.github/workflows/build-ghcr-image.yaml +++ b/.github/workflows/build-ghcr-image.yaml @@ -4,6 +4,12 @@ name: 'Build Image for GitHub Container Registry' on: workflow_call: + inputs: + environment: + description: 'The environment to deploy to ("production", "development")' + required: true + type: string + default: 'production' jobs: build_docker_image: @@ -13,6 +19,16 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Configure Dev image + if: ${{ inputs.environment == 'development' }} + run: | + cp config/.env.staging .env + + - name: Configure Prod image + if: ${{ inputs.environment == 'production' }} + run: | + cp config/.env.production .env + - name: Docker meta id: meta uses: docker/metadata-action@v4 diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 304d71a..ed5c828 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -19,7 +19,7 @@ jobs: name: Build Image for Development uses: ./.github/workflows/build-gcp-image.yaml with: - environment: development + environment: 'development' secrets: inherit @@ -32,7 +32,7 @@ jobs: uses: ./.github/workflows/cloud-run-deploy.yaml needs: build_gcp_image with: - environment: development + environment: 'development' version: ${{ needs.build_gcp_image.outputs.version }} - service: client-dev + service: 'client-dev' secrets: inherit diff --git a/.github/workflows/deploy-prod.yaml b/.github/workflows/deploy-prod.yaml index 3d2c7a8..5248d85 100644 --- a/.github/workflows/deploy-prod.yaml +++ b/.github/workflows/deploy-prod.yaml @@ -16,7 +16,7 @@ jobs: contents: read uses: ./.github/workflows/build-gcp-image.yaml with: - environment: production + environment: 'production' secrets: inherit deploy_to_cloud_run: @@ -28,12 +28,14 @@ jobs: uses: ./.github/workflows/cloud-run-deploy.yaml needs: build_gcp_image with: - environment: production + environment: 'production' version: ${{ needs.build_gcp_image.outputs.version }} - service: client + service: 'client' secrets: inherit build_ghcr_image: name: Build Image for GHCR uses: ./.github/workflows/build-ghcr-image.yaml - secrets: inherit \ No newline at end of file + secrets: inherit + with: + environment: 'production' \ No newline at end of file diff --git a/Dockerfile.staging b/Dockerfile.staging deleted file mode 100644 index d63ff7c..0000000 --- a/Dockerfile.staging +++ /dev/null @@ -1,17 +0,0 @@ -# Mutlistage dockerize dpgraham.com react.js front end -# Build stage -FROM node:18-alpine as builder -WORKDIR /app -COPY . . -RUN npm ci --silent -RUN npm run build:staging - -# Bundle stage -FROM nginx:1.25.1-alpine as production -ENV NODE_ENV production -COPY --from=builder /app/build /usr/share/nginx/html -# Add nginx.conf -COPY nginx.conf /etc/nginx/conf.d/default.conf -EXPOSE 3000 -# Start nginx -CMD ["nginx", "-g", "daemon off;"] diff --git a/.env.production b/config/.env.production similarity index 100% rename from .env.production rename to config/.env.production diff --git a/.env.staging b/config/.env.staging similarity index 100% rename from .env.staging rename to config/.env.staging diff --git a/src/features/Resume/Resume.tsx b/src/features/Resume/Resume.tsx index 8b230fd..9b0af2d 100644 --- a/src/features/Resume/Resume.tsx +++ b/src/features/Resume/Resume.tsx @@ -18,7 +18,6 @@ const fabStyle = { * @constructor */ export function Resume() { - // ToDo - Add a way to download PDF resume useTitle("Resume"); return (