Skip to content
This repository was archived by the owner on Dec 20, 2022. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.18-alpine AS base

RUN set -eux \
&& apk --no-cache add ca-certificates \
&& apk --no-cache add --virtual build-dependencies cmake g++ make unzip curl git
&& apk --no-cache add --virtual build-dependencies cmake g++ make unzip curl git libcap

WORKDIR ${GOPATH}/src/github.com/yahoojapan/authorization-proxy

Expand Down Expand Up @@ -31,6 +31,9 @@ RUN BUILD_TIME=$(date -u +%Y%m%d-%H%M%S) \
GO111MODULE=on \
go build -ldflags "-X 'main.Version=${VERSION} at ${BUILD_TIME} by ${GO_VERSION}' -linkmode=external" -a -o "/usr/bin/${APP_NAME}"

# allow well-known port binding
RUN setcap 'cap_net_bind_service=+ep' "/usr/bin/${APP_NAME}"

# confirm dependency libraries & cleanup
RUN ldd "/usr/bin/${APP_NAME}"\
&& apk del build-dependencies --purge \
Expand All @@ -52,6 +55,7 @@ COPY --from=builder /usr/bin/${APP_NAME} /go/bin/${APP_NAME}
COPY --from=builder /lib/ld-musl-x86_64.so* /lib/
# Copy user
COPY --from=builder /etc/passwd /etc/passwd
USER ${APP_NAME}

HEALTHCHECK NONE
ENTRYPOINT ["/go/bin/authorization-proxy"]