add a dev version of docker-compose #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker image | |
on: | |
push: | |
branches: [ main ] | |
# only build when important files change | |
paths: | |
- 'app/**' | |
- 'Dockerfile' | |
- '.github/workflows/build_docker_image.yaml' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- | |
# we need qemu and buildx so we can build multiple platforms later | |
name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: read tags | |
run: | | |
echo "VERSION=$(cat app/version.txt)" >> $GITHUB_ENV | |
- name: debug | |
run: | | |
echo "TEST ${{ secrets.DOCKERHUB_USERNAME }} ${{ secrets.DOCKERHUB_TOKEN }} credentials" | |
echo "VERSION=${{ env.VERSION }}" | |
- name: Login to DockerHub XXXX | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: alexobunnyshell/example-github-actions | |
# flavor: latest=false | |
# tags: ${{ inputs.tag-rules }} | |
tags: | | |
latest | |
${{ env.VERSION }} | |
# - name: Build and push | |
# uses: docker/build-push-action@v2 | |
# with: | |
# context: . | |
# file: ./Dockerfile | |
# push: true | |
# tags: alexobunnyshell/example-github-actions:0.0.1 | |
- | |
name: Docker Build and Push | |
id: build_image | |
uses: docker/build-push-action@v3 | |
with: | |
platforms: ${{ inputs.platforms }} | |
context: . | |
file: ./Dockerfile | |
builder: ${{ steps.buildx.outputs.name }} | |
# it uses github cache API for faster builds: | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} |