-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1621 from ministryofjustice/scratch
Use scratch for image bases
- Loading branch information
Showing
5 changed files
with
30 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
FROM golang:1.23.3-alpine AS build-env | ||
|
||
RUN apk --no-cache add openssl=3.3.2-r1 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
RUN apk --no-cache add openssl=3.3.2-r1 | ||
|
||
COPY --link go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY cmd/mock-notify ./cmd/mock-notify | ||
COPY --link cmd/mock-notify ./cmd/mock-notify | ||
|
||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -installsuffix cgo -o /go/bin/mock-notify ./cmd/mock-notify | ||
|
||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -installsuffix cgo -o mock-notify ./cmd/mock-notify | ||
FROM scratch AS production | ||
|
||
RUN addgroup --system app && \ | ||
adduser --system --gecos app app && \ | ||
chown -R app:app /app | ||
WORKDIR /go/bin | ||
|
||
USER app | ||
COPY --from=build-env /go/bin/mock-notify mock-notify | ||
|
||
CMD [ "/app/mock-notify" ] | ||
CMD [ "./mock-notify" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
FROM golang:1.23.3-alpine AS build-env | ||
|
||
RUN apk --no-cache add openssl=3.3.2-r1 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
RUN apk --no-cache add openssl=3.3.2-r1 | ||
|
||
COPY --link go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY cmd/mock-os-api ./cmd/mock-os-api | ||
COPY docker/mock-os-api/data ./data | ||
COPY --link cmd/mock-os-api ./cmd/mock-os-api | ||
|
||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -installsuffix cgo -o /go/bin/mock-os-api ./cmd/mock-os-api | ||
|
||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -installsuffix cgo -o mock-os-api ./cmd/mock-os-api | ||
FROM scratch AS production | ||
|
||
RUN addgroup --system app && \ | ||
adduser --system --gecos app app && \ | ||
chown -R app:app /app | ||
WORKDIR /go/bin | ||
|
||
USER app | ||
COPY --from=build-env /go/bin/mock-os-api mock-os-api | ||
COPY --link docker/mock-os-api/data data | ||
|
||
CMD [ "/app/mock-os-api" ] | ||
CMD [ "./mock-os-api" ] |
This file was deleted.
Oops, something went wrong.