Skip to content

Commit

Permalink
Merge pull request #27 from TheManWhoLikesToCode/TheManWhoLikesToCode…
Browse files Browse the repository at this point in the history
…-patch-1

Naming of docker image action
  • Loading branch information
TheManWhoLikesToCode authored Jan 8, 2024
2 parents bd00358 + 455d4c0 commit 8f3dd1d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
types: [published]

jobs:

backend-build:
runs-on: ubuntu-latest
steps:
Expand All @@ -18,11 +17,14 @@ jobs:

- name: Build and push the Docker image for backend
run: |
TIMESTAMP=$(date +%s)
docker build ./backend -t themanwholikestocode/archive-me-prod:backend-$TIMESTAMP
docker tag themanwholikestocode/archive-me-prod:backend-$TIMESTAMP domain.com/repo/tag_docker_name:latest
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-$TIMESTAMP
docker push themanwholikestocode/archive-me-prod:backend-$DOCKER_IMAGE_TAG
frontend-build:
runs-on: ubuntu-latest
Expand All @@ -32,8 +34,11 @@ jobs:

- name: Build and push the Docker image for frontend
run: |
TIMESTAMP=$(date +%s)
docker build ./frontend -t themanwholikestocode/archive-me-prod:frontend-$TIMESTAMP
docker tag themanwholikestocode/archive-me-prod:frontend-$TIMESTAMP domain.com/repo/tag_docker_name:latest
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-$TIMESTAMP
docker push themanwholikestocode/archive-me-prod:frontend-$DOCKER_IMAGE_TAG

0 comments on commit 8f3dd1d

Please sign in to comment.