chore: add dockerfile and ci

This commit is contained in:
2026-06-14 00:34:37 +03:00
committed by zero@thinky
parent 35ddfc938c
commit 9d2f69898a
2 changed files with 51 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
name: ci
on:
push:
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Go setup
uses: actions/setup-go@v6
with:
go-version: "1.26.1"
cache: false
- name: Install deps
run: go mod tidy
- name: Golangci-lint
uses: golangci/golangci-lint-action@v9
with:
args: --timeout=5m
skip-cache: true
- name: Run tests
run: go test ./...
- name: Build
run: go build -o backend ./cmd/main.go
+22
View File
@@ -0,0 +1,22 @@
FROM golang:1.26.1 as builder
WORKDIR /app
COPY . .
ENV CGO_ENABLED=0
ENV GIN_MODE=release
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download && \
go build -ldflags "-s -w" -o backend ./cmd/main.go
FROM alpine:3.23.0
RUN apk add --no-cache curl openssl bash
COPY --from=builder /app/backend .
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "curl --fail http://localhost:8080/health" ]
CMD ["./backend"]