diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..ef72bcfa --- /dev/null +++ b/.github/workflows/docker.yml @@ -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 }} diff --git a/Dockerfile b/Dockerfile index 55ede84f..fe76f89e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# Download base image ubuntu 20.04 +# Download base image ubuntu 16.04 FROM ubuntu:16.04 MAINTAINER Matej Trojak