Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile #300

Merged
merged 2 commits into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
memphis-broker
*.md
logos
logo*
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ FROM golang:1.18-alpine3.15 as build

WORKDIR $GOPATH/src/memphis-broker
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-w" -a -o /memphis-broker

RUN CGO_ENABLED=0 go build -ldflags="-w" -a -o .

FROM alpine:3.15
ENV GOPATH="/go/src"
WORKDIR /run
COPY --from=build $GOPATH/memphis-broker/config/* config/

RUN apk add --update ca-certificates && mkdir -p /nats/bin && mkdir /nats/conf

COPY docker/nats-server.conf /nats/conf/nats-server.conf
COPY --from=build $GOPATH/memphis-broker/memphis-broker /bin/nats-server
COPY --from=build $GOPATH/memphis-broker/conf/* conf/
COPY --from=build $GOPATH/memphis-broker/version.conf .
COPY --from=build /memphis-broker memphis-broker

EXPOSE 5555
EXPOSE 5555 6666 8222

CMD ["/run/memphis-broker"]
ENTRYPOINT ["/bin/nats-server"]
CMD ["-c", "/nats/conf/nats-server.conf"]