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" ]