mirror of
https://codeberg.org/Hyperpipe/hyperpipe-backend
synced 2024-12-06 19:26:30 +01:00
Improve Dockerfile
This commit is contained in:
+2
-1
@@ -2,4 +2,5 @@
|
||||
.gitignore
|
||||
.dockerignore
|
||||
*.md
|
||||
*.txt
|
||||
*.txt
|
||||
*.yml
|
||||
|
||||
+10
-4
@@ -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
|
||||
CMD ./hyperpipe-backend
|
||||
|
||||
Reference in New Issue
Block a user