Skip to content

Commit

Permalink
Update docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
TheManWhoLikesToCode authored Jan 9, 2024
1 parent 8f3dd1d commit 1b2fbfd
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -15,30 +15,32 @@ jobs:
- name: Checkout backend code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push the Docker image for backend
run: |
if [ ${{ github.event_name }} == 'pull_request' ]; then
DOCKER_IMAGE_TAG=development
else
DOCKER_IMAGE_TAG=production
fi
docker build ./backend -t themanwholikestocode/archive-me-prod:backend-$DOCKER_IMAGE_TAG
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker push themanwholikestocode/archive-me-prod:backend-$DOCKER_IMAGE_TAG
uses: docker/build-push-action@v2
with:
context: ./backend
push: true
tags: themanwholikestocode/archive-me-prod:backend-${{ github.event_name == 'pull_request' && 'development' || 'production' }}
build-args: |
BUILDPLATFORM=linux/amd64
frontend-build:
runs-on: ubuntu-latest
steps:
- name: Checkout frontend code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build and push the Docker image for frontend
run: |
if [ ${{ github.event_name }} == 'pull_request' ]; then
DOCKER_IMAGE_TAG=development
else
DOCKER_IMAGE_TAG=production
fi
docker build ./frontend -t themanwholikestocode/archive-me-prod:frontend-$DOCKER_IMAGE_TAG
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker push themanwholikestocode/archive-me-prod:frontend-$DOCKER_IMAGE_TAG
uses: docker/build-push-action@v2
with:
context: ./frontend
push: true
tags: themanwholikestocode/archive-me-prod:frontend-${{ github.event_name == 'pull_request' && 'development' || 'production' }}
build-args: |
BUILDPLATFORM=linux/amd64

0 comments on commit 1b2fbfd

Please sign in to comment.