add GitHub Actions workflow and Dockerfile for building and pushing container image
Some checks failed
Build and Push Container Image / build-and-push-and-deploy (push) Failing after 1m51s

This commit is contained in:
2025-06-16 00:43:17 +08:00
commit abfbb698f2
6 changed files with 126 additions and 0 deletions

33
Dockerfile Normal file
View File

@ -0,0 +1,33 @@
# build
FROM reg.liteyuki.org/dockerhub/golang:1.24.2-alpine3.21 AS builder
ENV TZ=Asia/Chongqing
WORKDIR /app
RUN apk --no-cache add build-base git tzdata
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o main main.go
# production
FROM reg.liteyuki.org/dockerhub/alpine:latest AS prod
ENV TZ=Asia/Chongqing
WORKDIR /app
RUN apk --no-cache add tzdata ca-certificates libc6-compat libgcc libstdc++
COPY --from=builder /app/main /app/main
EXPOSE 8888
RUN chmod +x ./main
ENTRYPOINT ["./main"]