diff --git a/.github/workflows/docker-yml b/.github/workflows/docker-yml new file mode 100644 index 0000000..e070bc2 --- /dev/null +++ b/.github/workflows/docker-yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2429f6e..190f964 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -12,12 +12,12 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20 - name: Vverify dependencies run: go mod verify diff --git a/Dockerfile b/Dockerfile index 3002884..fe3aa1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -ldflags '-extldflags "-sta FROM scratch 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/ # the tls certificates: # NB: this pulls directly from the upstream image, which already has ca-certificates: diff --git a/cmd/main.go b/cmd/main.go index bea4632..6d672ab 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -71,6 +71,8 @@ func run(conf domain.Config) { } fmt.Printf("Applied %d migrations!\n", n) + db.Close() + // gitService := services.NewGit(conf.Git)