add docker tasks

This commit is contained in:
onyx-and-iris 2025-03-16 01:04:16 +00:00
parent 1bbe3102ce
commit 916d2a2d86
5 changed files with 34 additions and 7 deletions

9
.gitignore vendored

@ -1,3 +1,5 @@
# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore
### Go ###
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
@ -20,10 +22,7 @@ bin/
# Go workspace file
go.work
# End of gignore: github.com/onyx-and-iris/gignore
# Added by goreleaser init:
dist/
# testing
run.sh
server.yaml
dist/

@ -1,5 +1,8 @@
version: '3'
includes:
docker: ./docker/Taskfile.docker.yml
vars:
PROGRAM: q3rcon-proxy
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
@ -38,11 +41,13 @@ tasks:
desc: Build the q3rcon-proxy project for Windows
cmds:
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
internal: true
build-linux:
desc: Build the q3rcon-proxy project for Linux
cmds:
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/
internal: true
test:
desc: Run tests

@ -1,4 +1,4 @@
FROM golang:1.21 AS build_image
FROM golang:1.24 AS build_image
WORKDIR /usr/src/app

@ -0,0 +1,23 @@
version: '3'
tasks:
build:
desc: Build the Docker image
cmds:
- docker build -t q3rcon-proxy -f docker/Dockerfile .
dir: .
login:
desc: Login to Github Container Registry
cmds:
- docker login ghcr.io -u onyx-and-iris --password-stdin <<< {{.GHCR_TOKEN}}
internal: true
push:
desc: Push the Docker image to Github Container Registry
deps:
- task: build
- task: login
cmds:
- docker tag q3rcon-proxy ghcr.io/onyx-and-iris/q3rcon-proxy:latest
- docker push ghcr.io/onyx-and-iris/q3rcon-proxy:latest

2
go.mod

@ -1,6 +1,6 @@
module github.com/onyx-and-iris/q3rcon-proxy
go 1.23.0
go 1.24.0
toolchain go1.24.1