Skip to content

Commit

Permalink
Add prod image
Browse files Browse the repository at this point in the history
  • Loading branch information
elhmn committed Aug 10, 2024
1 parent b372f5a commit e3125b2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/deploy-frontend-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build frontend prod image

on:
push:
branches:
# should be changed to main before merge
- deploy-using-docker
paths:
- frontend/**
- .github/workflows/deploy-frontend-prod.yaml

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-frontend-prod

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,enable=true,priority=100,prefix=,suffix=,format=long
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./frontend
build-args: |
baseURL=https://api.osscameroon.com
env=production
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build frontend image
name: Build frontend stage image

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
- deploy-using-docker
paths:
- frontend/**
- .github/workflows/deploy-frontend.yaml
- .github/workflows/deploy-frontend-stage.yaml

env:
REGISTRY: ghcr.io
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:12.22-buster-slim
ARG baseURL="localhost:8811"
ARG baseURL="http://127.0.0.1:8811"
ARG env="development"
ENV REACT_APP_API_BASE_URL=$baseURL
ENV REACT_APP_ENV=$env
Expand Down

0 comments on commit e3125b2

Please sign in to comment.