diff --git a/.dockerignore b/.dockerignore index 260d911..1066e94 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,5 @@ .gitignore .dockerignore *.md -*.txt \ No newline at end of file +*.txt +*.yml diff --git a/Dockerfile b/Dockerfile index bcbc1ae..906eae9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM --platform=$BUILDPLATFORM golang:alpine AS build +FROM --platform=$BUILDPLATFORM docker.io/golang:latest AS build -WORKDIR /app/ +WORKDIR /src RUN apk --no-cache add ca-certificates @@ -9,8 +9,14 @@ COPY . . ARG TARGETOS TARGETARCH RUN GOPROXY=https://proxy.golang.org,https://goproxy.cn go mod download && \ - CGO=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags "-s -w" + CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags "-s -w" -o /src/hyperpipe-backend + +FROM scratch as bin + +WORKDIR /app +COPY --from=build /etc/ssl/certs/cacertificates.crt /etc/ssl/certs/ +COPY --from=build /src/hyperpipe-backend . EXPOSE 3000 -CMD ./hyperpipe-backend \ No newline at end of file +CMD ./hyperpipe-backend