chore: add Docker build workflow configuration
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
name: Build & Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Read version from package.json
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
# - name: Log in to private registry
|
||||
# run: |
|
||||
# echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login \
|
||||
# ${{ secrets.REGISTRY_URL }} \
|
||||
# -u "${{ secrets.REGISTRY_USER }}" \
|
||||
# --password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build \
|
||||
-t ${{ secrets.REGISTRY_URL }}/${{ secrets.IMAGE_NAME }}:${{ steps.version.outputs.version }} \
|
||||
.
|
||||
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
docker push \
|
||||
${{ secrets.REGISTRY_URL }}/${{ secrets.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
||||
|
||||
- name: Tag latest
|
||||
run: |
|
||||
docker tag \
|
||||
${{ secrets.REGISTRY_URL }}/${{ secrets.IMAGE_NAME }}:${{ steps.version.outputs.version }} \
|
||||
${{ secrets.REGISTRY_URL }}/${{ secrets.IMAGE_NAME }}:latest
|
||||
|
||||
docker push \
|
||||
${{ secrets.REGISTRY_URL }}/${{ secrets.IMAGE_NAME }}:latest
|
||||
Reference in New Issue
Block a user