diff --git a/.github/workflows/docker-app.yml b/.github/workflows/docker-app.yml new file mode 100644 index 0000000..9f780f5 --- /dev/null +++ b/.github/workflows/docker-app.yml @@ -0,0 +1,44 @@ +name: Docker image app + +on: + workflow_dispatch: + inputs: + webapp_tag: + description: "Docker tag for webapp image (without starting 'v')" + required: true + default: "latest" + type: string +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: "ghcr.io/smc40/askyourdocs-app" + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}