forked from Ilhasoft/rp-archiver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update dockerfile to be compatible with current go version
- Loading branch information
Showing
1 changed file
with
8 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,19 @@ | ||
FROM golang:1.17.5-alpine3.14 AS builder | ||
FROM golang:1.23-alpine3.20 AS builder | ||
|
||
WORKDIR /app | ||
|
||
RUN apk add --no-cache --virtual build-deps curl gcc | ||
|
||
COPY go.sum go.mod ./ | ||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
go mod download -x | ||
|
||
COPY . . | ||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
--mount=type=bind,target=. \ | ||
go install -v ./cmd/... | ||
|
||
FROM alpine:3.18.4 | ||
WORKDIR /src | ||
|
||
RUN apk add --no-cache tzdata | ||
COPY go.mod go.sum ./ | ||
RUN go mod download -x | ||
|
||
ENV APP_USER=app \ | ||
APP_GROUP=app \ | ||
USER_ID=11999 \ | ||
GROUP_ID=11999 | ||
COPY . ./ | ||
|
||
RUN addgroup --system --gid ${GROUP_ID} ${APP_GROUP} \ | ||
&& adduser --system --disabled-password --home /home/${APP_USER} \ | ||
--uid ${USER_ID} --ingroup ${APP_GROUP} ${APP_USER} | ||
RUN GOOS=linux GOARCH=amd64 go build -o /bin/rp-archiver ./cmd/rp-archiver/*.go | ||
|
||
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /go/bin/ /app/ | ||
FROM alpine:3.20 | ||
|
||
WORKDIR /app | ||
|
||
USER ${APP_USER}:${APP_GROUP} | ||
COPY --from=builder bin/rp-archiver ./ | ||
|
||
EXPOSE 8080 | ||
ENTRYPOINT ["./rp-archiver"] |