Update docker-image.yml
This commit is contained in:
parent
04f0492ba5
commit
8c2f3c7602
1 changed files with 12 additions and 3 deletions
15
.github/workflows/docker-image.yml
vendored
15
.github/workflows/docker-image.yml
vendored
|
@ -3,16 +3,25 @@ name: Docker Image CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
pull_request:
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Build the Docker image
|
- name: Build the Docker image
|
||||||
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
|
run: docker build . --file Dockerfile --tag my-image-name:latest
|
||||||
|
- name: Log in to registry
|
||||||
|
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
|
||||||
|
- name: Push image
|
||||||
|
run: |
|
||||||
|
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
|
||||||
|
TAG=$(date +"%Y-%m-%dT%H-%M")
|
||||||
|
docker tag $IMAGE_NAME $IMAGE_ID:$TAG
|
||||||
|
docker push $IMAGE_ID:$TAG
|
||||||
|
|
Loading…
Reference in a new issue