Skip to content

Commit

Permalink
Added a github action to create a Docker image and push it to the doc…
Browse files Browse the repository at this point in the history
…ker registry when a new release is published (will trigger on released and prereleased)
  • Loading branch information
vanbuiten committed Feb 25, 2022
1 parent c96a566 commit 5b75022
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build_and_push_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build a Docker image and push to Docker when a new release is published

on:
release:
types: [ published ]

jobs:
build_and_push:
name: Build an Docker image for the release and push it to Docker
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Login to Docker
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: Release tag
run: echo "${{ github.event.release.tag_name }}"

- name: Build the Docker image release
run: |
cd api/
docker build -t signalen/backend:${{ github.event.release.tag_name }} .
- name: Push the tagged image to Docker
run: docker push signalen/backend:${{ github.event.release.tag_name }}

0 comments on commit 5b75022

Please sign in to comment.