From e34e1e9ebaac09c9bd29e1cc4dca12486872d816 Mon Sep 17 00:00:00 2001 From: Sam A Date: Mon, 7 Nov 2022 10:48:33 +0100 Subject: [PATCH] CI/CD: Automatically publish Docker image (#349) --- .github/workflows/docker-image.yml | 28 ++++++++++++++++++++++++++++ docker-compose.yml | 3 +-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 000000000..34dbe7024 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,28 @@ +name: Build and publish Docker image +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + publish: + name: Build and publish Docker image + runs-on: ubuntu-latest + steps: + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Build and publish image + uses: docker/build-push-action@v3 + with: + push: true + tags: | + ${{ secrets.DOCKER_USERNAME }}/rallly:latest + ${{ secrets.DOCKER_USERNAME }}/rallly:${{ github.sha }} diff --git a/docker-compose.yml b/docker-compose.yml index 023dfcb34..ef866667c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,7 @@ services: retries: 5 rallly: - build: - context: . + image: lukevella/rallly:latest restart: always depends_on: rallly_db: