docker and CI (#1)
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/dryrun Pipeline was successful
ci/woodpecker/push/publish-tag Pipeline was successful
ci/woodpecker/push/publish-latest Pipeline failed

Reviewed-on: #1
Co-authored-by: Michael Thomson <michael@michaelthomson.dev>
Co-committed-by: Michael Thomson <michael@michaelthomson.dev>
This commit is contained in:
Michael Thomson 2024-06-09 03:23:09 +00:00 committed by mthomson
parent 277fa92564
commit 23ac1417be
6 changed files with 72 additions and 1 deletions

12
.woodpecker/build.yaml Normal file
View File

@ -0,0 +1,12 @@
steps:
build:
when:
branch: main
event: [push, pull_request]
image: golang
environment:
- CGO_ENABLED=0
- GOOS=linux
commands:
- go get
- go build

14
.woodpecker/dryrun.yaml Normal file
View File

@ -0,0 +1,14 @@
steps:
dryrun:
image: woodpeckerci/plugin-kaniko
settings:
dry_run: true
repo: gitea.michaelthomson.dev/${CI_REPO_OWNER}/go-todos-app
tags: latest
when:
branch: main
event: [push, pull_request]
depends_on:
- build

View File

@ -0,0 +1,17 @@
steps:
publish-latest:
image: woodpeckerci/plugin-kaniko
settings:
repo: gitea.michaelthomson.dev/${CI_REPO_OWNER}/go-todos-app
registry: https://gitea.michaelthomson.dev
tags: latest
username: ${CI_REPO_OWNER}
password:
from_secret: gitea_token
when:
branch: main
event: [push]
depends_on:
- build
- dryrun

View File

@ -0,0 +1,18 @@
steps:
publish-tag:
image: woodpeckerci/plugin-kaniko
settings:
repo: gitea.michaelthomson.dev/${CI_REPO_OWNER}/go-todos-app
registry: https://gitea.michaelthomson.dev
tags: ${CI_COMMIT_TAG}
username: ${CI_REPO_OWNER}
password:
from_secret: gitea_token
when:
event: tag
ref: refs/tags/v*
branch: main
depends_on:
- build
- dryrun

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
# syntax=docker/dockerfile:1
FROM golang:1.22-alpine
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /entrypoint
EXPOSE 3000
ENTRYPOINT ["/entrypoint"]

2
go.mod
View File

@ -2,4 +2,4 @@ module michaelthomson.dev/mthomson/go-todos-app
go 1.22.1
require github.com/a-h/templ v0.2.707 // indirect
require github.com/a-h/templ v0.2.707