mirror of
https://github.com/yusing/godoxy.git
synced 2025-07-04 06:04:24 +02:00
chore: remove unnecessary setcap from dockerfile
This commit is contained in:
parent
38e8f8d553
commit
628dc94924
2 changed files with 12 additions and 14 deletions
16
Dockerfile
16
Dockerfile
|
@ -4,22 +4,20 @@ HEALTHCHECK NONE
|
|||
|
||||
# package version does not matter
|
||||
# trunk-ignore(hadolint/DL3018)
|
||||
RUN apk add --no-cache tzdata make libcap-setcap
|
||||
RUN apk add --no-cache tzdata make
|
||||
|
||||
# Stage 2: builder
|
||||
FROM deps AS builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
COPY Makefile ./
|
||||
COPY cmd ./cmd
|
||||
COPY internal ./internal
|
||||
COPY pkg ./pkg
|
||||
COPY agent ./agent
|
||||
|
||||
# Only copy go.mod and go.sum initially for better caching
|
||||
COPY go.mod go.sum /src/
|
||||
|
||||
ENV GOPATH=/root/go
|
||||
RUN go mod download -x
|
||||
|
||||
|
@ -31,9 +29,8 @@ ENV MAKE_ARGS=${MAKE_ARGS}
|
|||
|
||||
ENV GOCACHE=/root/.cache/go-build
|
||||
ENV GOPATH=/root/go
|
||||
RUN make ${MAKE_ARGS} build link-binary && \
|
||||
mv bin /app/ && \
|
||||
mkdir -p /app/error_pages /app/certs
|
||||
RUN make ${MAKE_ARGS} docker=1 build link-binary && \
|
||||
mv bin /app/
|
||||
|
||||
# Stage 3: Final image
|
||||
FROM scratch
|
||||
|
@ -45,10 +42,7 @@ LABEL proxy.exclude=1
|
|||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
|
||||
# copy binary
|
||||
COPY --from=builder /app /app
|
||||
|
||||
# copy example config
|
||||
COPY config.example.yml /app/config/config.yml
|
||||
COPY --from=builder /app/bin /app/bin
|
||||
|
||||
# copy certs
|
||||
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
||||
|
|
4
Makefile
4
Makefile
|
@ -53,11 +53,15 @@ export GODEBUG
|
|||
export GORACE
|
||||
export BUILD_FLAGS
|
||||
|
||||
ifeq (${docker}, 0)
|
||||
ifeq ($(shell id -u), 0)
|
||||
SETCAP_CMD = setcap
|
||||
else
|
||||
SETCAP_CMD = sudo setcap
|
||||
endif
|
||||
else
|
||||
SETCAP_CMD = echo
|
||||
endif
|
||||
|
||||
.PHONY: debug
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue