Build Application Docker #2
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
on: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
name: Build Application Docker | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: gravity-ui/node-nginx | |
IMAGE_OS_NODE_VERSION: ubuntu20-nodejs18 | |
jobs: | |
build: | |
name: docker-nodejs | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: 'arm64' | |
- uses: docker/setup-buildx-action@v3 | |
- name: 'Get release build date' | |
run: | | |
BUILD_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d) | |
echo "Release build date: ${BUILD_DATE}" | |
echo "BUILD_DATE=$BUILD_DATE" >> "$GITHUB_ENV" | |
- name: Log in to the Container registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract tags for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=${{ env.IMAGE_OS_NODE_VERSION }} | |
type=raw,value=${{ env.IMAGE_OS_NODE_VERSION }}.${{ env.BUILD_DATE }} | |
- name: Build and push Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |