Skip to content

Commit

Permalink
init docker image build and push
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskarowski committed Sep 10, 2024
1 parent 42bc76a commit 03227e5
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Push Docker Image

on:
push:
branches:
- master

jobs:
build-and-push-image:
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

- name: Log in to Docker Hub
run: |
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_TOKEN }}
# Docker build
- name: Docker build
run: |
IMAGE_NAME=oskarowskii/minesweeper-golang-htmx
COMMIT_SHA=${{ github.sha }}
docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$COMMIT_SHA .
# Push to Docker Hub
- name: Push to Docker Hub
run: |
IMAGE_NAME=oskarowskii/minesweeper-golang-htmx
COMMIT_SHA=${{ github.sha }}
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$COMMIT_SHA

0 comments on commit 03227e5

Please sign in to comment.