-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add ci build application docker * fix build version tag from commit
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
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 |