feat: init

This commit is contained in:
tiennm99 committed 2025-11-27 22:32:53 +07:00
1 parent 6cc81d397a
commit c334a4b54f
7 files changed
+188

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
ARG GO_VERSION=1.24.10
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build
WORKDIR /src
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x
ARG TARGETARCH
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,target=. \
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server .
FROM alpine:latest AS final
RUN --mount=type=cache,target=/var/cache/apk \
apk --update add \
ca-certificates \
tzdata \
&& \
update-ca-certificates
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
RUN mkdir -p /app && chown -R appuser:appuser /app
USER appuser
COPY --from=build /bin/server /bin/
WORKDIR /app
EXPOSE 1999
ENTRYPOINT [ "/bin/server" ]