Skip to content

Commit

Permalink
Create docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ellermister authored Nov 14, 2023
1 parent 97c1eb4 commit b42a903
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Docker Image CI

on:
workflow_dispatch:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

env:
UPLOAD_IMAGES: true
PUSH_IMAGES: true
RELEASE_IMAGE_TAG: registry.x7.pw/shourturl:latest

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag ${{ env.RELEASE_IMAGE_TAG }}
echo "status=success" >> $GITHUB_OUTPUT
echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
docker save ${{ env.RELEASE_IMAGE_TAG }} > docker.tar
- name: Push images to private regitry
if: steps.compile.outputs.status == 'success' && env.PUSH_IMAGES == 'true'
run: docker push ${{ env.RELEASE_IMAGE_TAG }}

- name: Upload images
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && env.UPLOAD_IMAGES == 'true'
with:
name: ShortURL_Images${{ env.FILE_DATE }}
path: docker.tar

0 comments on commit b42a903

Please sign in to comment.