diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..104ce6d1 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,28 @@ +name: Docker Image CI + +on: + push: + tags: + - 'v*' + +jobs: + + build_and_push_latest: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build docker-compose latest + run: GITHUB_API_TOKEN='${{ secrets.GITHUB_TOKEN }}' docker-compose build + - name: Push latest image + run: GITHUB_API_TOKEN='${{ secrets.GITHUB_TOKEN }}' docker-compose build + - name: Build docker-compose tag + run: GITHUB_API_TOKEN='${{ secrets.GITHUB_TOKEN }}' GROCY_IMAGE_TAG="$(git describe --abbrev=0 --tags)" docker-compose build + - name: Push tag + run: docker-compose push diff --git a/docker-compose.yml b/docker-compose.yml index 19df8e7e..ed283788 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '2.4' services: nginx: - image: "grocy/nginx:v3.0.0-1" + image: "grocy/nginx:${GROCY_IMAGE_TAG:-latest}" build: args: GROCY_VERSION: v3.0.0 @@ -22,7 +22,7 @@ services: container_name: nginx grocy: - image: "grocy/grocy:v3.0.0-1" + image: "grocy/grocy:${GROCY_IMAGE_TAG:-latest}" build: args: GITHUB_API_TOKEN: "${GITHUB_API_TOKEN}"