reworking git structure
All checks were successful
Build and Push Docker Image / docker (push) Successful in 48s
All checks were successful
Build and Push Docker Image / docker (push) Successful in 48s
This commit is contained in:
41
.gitea/workflows/docker-build-push.yml
Normal file
41
.gitea/workflows/docker-build-push.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: docker-host
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
run:
|
||||
echo "$DOCKERHUB_TOKEN" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
|
||||
|
||||
- name: Build image
|
||||
env:
|
||||
IMAGE_NAME: ${{ vars.DOCKERHUB_REPOSITORY }}
|
||||
run: |
|
||||
test -n "$IMAGE_NAME"
|
||||
SHORT_SHA="$(git rev-parse --short HEAD)"
|
||||
docker build -t "$IMAGE_NAME:latest" -t "$IMAGE_NAME:$SHORT_SHA" .
|
||||
|
||||
- name: Push image
|
||||
env:
|
||||
IMAGE_NAME: ${{ vars.DOCKERHUB_REPOSITORY }}
|
||||
run: |
|
||||
test -n "$IMAGE_NAME"
|
||||
SHORT_SHA="$(git rev-parse --short HEAD)"
|
||||
docker push "$IMAGE_NAME:latest"
|
||||
docker push "$IMAGE_NAME:$SHORT_SHA"
|
||||
Reference in New Issue
Block a user