try github actions
This commit is contained in:
parent
632fbd249e
commit
f7dd74ffff
|
|
@ -0,0 +1,31 @@
|
||||||
|
name: Build and Publish Docker Container
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ secrets.GITHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/${{ github.repository }}/my-docker-container:latest
|
||||||
|
|
@ -12,12 +12,12 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: 1.19
|
go-version: 1.20
|
||||||
- name: Vverify dependencies
|
- name: Vverify dependencies
|
||||||
run: go mod verify
|
run: go mod verify
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -ldflags '-extldflags "-sta
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=app-builder /go/bin/main /ticket-pimp
|
COPY --from=app-builder /go/bin/main /ticket-pimp
|
||||||
COPY --from=app-builder /go/src/ticket-pimp/cmd/prod.env /
|
COPY --from=app-builder /go/src/ticket-pimp/docker/prod.env /
|
||||||
COPY --from=app-builder /go/src/ticket-pimp/internal/storage/migrate/* /internal/storage/migrate/
|
COPY --from=app-builder /go/src/ticket-pimp/internal/storage/migrate/* /internal/storage/migrate/
|
||||||
# the tls certificates:
|
# the tls certificates:
|
||||||
# NB: this pulls directly from the upstream image, which already has ca-certificates:
|
# NB: this pulls directly from the upstream image, which already has ca-certificates:
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ func run(conf domain.Config) {
|
||||||
}
|
}
|
||||||
fmt.Printf("Applied %d migrations!\n", n)
|
fmt.Printf("Applied %d migrations!\n", n)
|
||||||
|
|
||||||
|
db.Close()
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
gitService := services.NewGit(conf.Git)
|
gitService := services.NewGit(conf.Git)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue