Files
knet/.github/workflows/docker-build.yml
JurajKubrican d62fe2dd87 rm duplicate
2024-10-28 14:25:04 +01:00

44 lines
1.1 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches:
- main
- ci-test
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.23'
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: |
IMAGE_NAME="ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/go-web-server:latest"
docker build -t "$IMAGE_NAME" .
- name: Build Docker image
run: |
docker build -t $IMAGE_NAME .
- name: Push Docker image to GitHub Container Registry
run: |
docker push $IMAGE_NAME
- name: Verify image is pushed
run: |
echo "Docker image pushed to: $IMAGE_NAME"