Skip to content

Update main.yml

Update main.yml #8

Workflow file for this run

name: build and dockerize the application
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Build
run: go build -v .
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and release to DockerHub
uses: docker/build-push-action@v5
with:
context: .
env:
NAME: knightchaser # DockerHub account name
REPO: goanonpicdb-aws # DockerHub repository name
run: |
docker build --tag $REPO ./Dockerfile
docker tag $REPO:latest $NAME/$REPO:latest
docker push $NAME/$REPO:latest