optimize dockerfile to match common structure
This commit is contained in:
parent
37083a382f
commit
c1f1cff2e7
1 changed files with 9 additions and 10 deletions
19
Dockerfile
19
Dockerfile
|
|
@ -6,7 +6,11 @@ COPY package.json package-lock.json ./
|
|||
|
||||
RUN npm install --omit=dev
|
||||
|
||||
FROM golang:1.24-alpine AS build
|
||||
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.9.0 AS xx
|
||||
FROM --platform=$BUILDPLATFORM golang:1.26.4-alpine AS build
|
||||
ARG TARGETPLATFORM
|
||||
ARG GOPROXY
|
||||
COPY --from=xx / /
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
|
|
@ -14,21 +18,16 @@ COPY go.mod ./
|
|||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
COPY --from=assets /src/node_modules ./node_modules
|
||||
|
||||
RUN go build -o /out/haste-server .
|
||||
RUN CGO_ENABLED=0 GOOS=linux xx-go build -ldflags "-w -s" -o /out/haste-server .
|
||||
|
||||
FROM alpine:3.21
|
||||
|
||||
RUN adduser -D -u 1000 appuser
|
||||
FROM jonasled.dev/infra/images/scratch-rootless:latest@sha256:8c33ba4e489ce0decd60f00ce63af60994b9b72cd39668284daea8eae1d809b7
|
||||
ENV GIN_MODE=release
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY --from=build /out/haste-server ./haste-server
|
||||
COPY --from=build /src/static ./static
|
||||
COPY --from=build /src/about.md ./about.md
|
||||
COPY --from=build /src/config.js ./config.js
|
||||
COPY --from=build /src/node_modules ./node_modules
|
||||
COPY ./static ./static
|
||||
|
||||
USER appuser
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue