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
Some checks failed
Build and Push Container Image / build-and-push-and-deploy (push) Failing after 1m51s
This commit is contained in:
33
Dockerfile
Normal file
33
Dockerfile
Normal 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"]
|
Reference in New Issue
Block a user