-
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 #7 from jr200/feature/minimise_image
reduce docker image size
- Loading branch information
Showing
8 changed files
with
128 additions
and
52 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ARG GOVERSION=1.22 | ||
FROM golang:${GOVERSION}-alpine AS builder | ||
|
||
ARG GOARCH | ||
ARG GOOS | ||
|
||
RUN apk update && apk add --no-cache git bash curl jq make | ||
|
||
RUN go install github.com/nats-io/nats-server/[email protected] | ||
RUN go install github.com/nats-io/natscli/[email protected] | ||
RUN go install github.com/nats-io/nsc/[email protected] | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN make build && \ | ||
ln -s /usr/src/app/build/nats-iam-broker-${GOOS}-${GOARCH} /usr/local/bin/nats-iam-broker && \ | ||
ln -s /usr/src/app/build/test-client-${GOOS}-${GOARCH} /usr/local/bin/test-client | ||
|
||
# minimal container | ||
FROM alpine:3 | ||
|
||
LABEL org.opencontainers.image.source="https://github.com/jr200/nats-iam-broker" | ||
LABEL org.opencontainers.image.description="nats-iam-broker runtime stage" | ||
|
||
RUN apk add --no-cache bash | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY --from=builder /usr/local/bin/nats-iam-broker /usr/local/bin/nats-iam-broker | ||
COPY --from=builder /usr/local/bin/test-client /usr/local/bin/test-client | ||
|
||
ENTRYPOINT ["bash"] |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
ARG GOVERSION=1.22 | ||
FROM golang:${GOVERSION}-alpine AS builder | ||
|
||
ARG GOARCH | ||
ARG GOOS | ||
|
||
RUN apk update && apk add --no-cache git bash curl jq make | ||
|
||
RUN go install github.com/nats-io/nats-server/[email protected] | ||
RUN go install github.com/nats-io/natscli/[email protected] | ||
RUN go install github.com/nats-io/nsc/[email protected] | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN make build && \ | ||
ln -s /usr/src/app/build/nats-iam-broker-${GOOS}-${GOARCH} /usr/local/bin/nats-iam-broker && \ | ||
ln -s /usr/src/app/build/test-client-${GOOS}-${GOARCH} /usr/local/bin/test-client | ||
|
||
# minimal container | ||
FROM alpine:3 | ||
|
||
|
||
LABEL org.opencontainers.image.source="https://github.com/jr200/nats-iam-broker" | ||
LABEL org.opencontainers.image.description="nats-iam-broker runtime stage" | ||
|
||
RUN apk add --no-cache bash curl jq && \ | ||
apk add --no-cache --update ca-certificates | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY --from=builder /usr/local/bin/nats-iam-broker /usr/local/bin/nats-iam-broker | ||
COPY --from=builder /usr/local/bin/test-client /usr/local/bin/test-client | ||
|
||
# for example programs | ||
COPY --from=builder /go/bin/nsc /bin/nsc | ||
COPY --from=builder /go/bin/nats /bin/nats | ||
COPY --from=builder /go/bin/nats-server /bin/nats-server | ||
COPY --from=builder /usr/src/app/configs /usr/src/app/configs | ||
COPY --from=builder /usr/src/app/examples /usr/src/app/examples | ||
COPY --from=builder /usr/src/app/scripts /usr/src/app/scripts | ||
|
||
ENTRYPOINT ["bash"] |
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