Skip to content

Commit

Permalink
CI build application docker (#4)
Browse files Browse the repository at this point in the history
* add ci build application docker

* fix build version tag from commit
  • Loading branch information
goshander authored Oct 25, 2023
1 parent a3eb8e4 commit e3bdaf4
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build_application_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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-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
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit e3bdaf4

Please sign in to comment.