Build Docker Images #1322
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 Docker Images | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
env: | |
DO_PUSH: ${{ github.ref == 'refs/heads/main' }} # do not push on PRs | |
jobs: | |
images: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
id: buildx | |
with: | |
install: true | |
- name: Docker rt meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: firefart/requesttracker | |
tags: | | |
# set latest tag for default branch | |
type=raw,value=latest,enable={{is_default_branch}} | |
# set rt version | |
type=raw,value=5.0.7,enable=true | |
# make a sha tag | |
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short | |
type=schedule,pattern={{date 'YYYYMMDD'}},prefix=nightly- | |
# add a nginx prefix for the nginx images | |
- name: Docker nginx meta | |
id: meta_nginx | |
uses: docker/metadata-action@v5 | |
with: | |
images: firefart/requesttracker | |
tags: | | |
# set latest tag for default branch | |
type=raw,value=nginx-latest,enable={{is_default_branch}} | |
# make a sha tag | |
type=sha,enable=true,priority=100,prefix=nginx-sha-,suffix=,format=short | |
type=schedule,pattern={{date 'YYYYMMDD'}},prefix=nginx-nightly- | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
if: env.DO_PUSH == 'true' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push RT | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ env.DO_PUSH }} | |
#platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build and push NGINX | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./nginx/ | |
push: ${{ env.DO_PUSH }} | |
#platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
tags: ${{ steps.meta_nginx.outputs.tags }} | |
labels: ${{ steps.meta_nginx.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |