From 16753914334dd257e68992f822f2f27e4aaaf0cd Mon Sep 17 00:00:00 2001 From: Quang Le Date: Fri, 8 Nov 2024 14:28:41 +0700 Subject: [PATCH] ci: add dockerfile --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..15c3064 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM dwarvesf/sql-migrate as sql-migrate + +FROM golang:1.23-alpine as builder +RUN mkdir /build +WORKDIR /build +COPY . . + +ENV GOOS=linux GOARCH=amd64 CGO_ENABLED=0 + +RUN set -ex && \ + apk add --no-progress --no-cache \ + gcc \ + musl-dev +RUN go install --tags musl ./... + +FROM alpine:3.15.0 +RUN apk --no-cache add ca-certificates +RUN ln -fs /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime +WORKDIR / + +COPY --from=sql-migrate /usr/local/bin/sql-migrate /usr/bin/ +COPY --from=builder /go/bin/* /usr/bin/ +# COPY migrations /migrations +# COPY dbconfig.yml / + +ENTRYPOINT [ "server" ]