Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming of docker image action #27

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading