Skip to content

Commit

Permalink
Added github workflow for automatic docker building on release
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrojak committed Aug 16, 2022
1 parent 350d170 commit 2f3822d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Docker Build and Publish Image
on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: sybila/parasim
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=release_tag::${{ github.event.release.tag_name }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
run: |
docker build \
--tag ${{ steps.prepare.outputs.docker_image }}:latest \
--tag ${{ steps.prepare.outputs.docker_image }}:${{ github.event.release.tag_name }} \
.
- name: Publish Docker image
# Only deploy if using master on original repo (and not for pull requests or forks)
if: github.repository_owner == 'sybila' && github.ref == 'refs/heads/master'
run: |
docker push --all-tags ${{ steps.prepare.outputs.docker_image }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Download base image ubuntu 20.04
# Download base image ubuntu 16.04
FROM ubuntu:16.04
MAINTAINER Matej Trojak <xtrojak@fi.muni.cz>

Expand Down

0 comments on commit 2f3822d

Please sign in to comment.