Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

CLEANUP: Tweak Dockerfile a little and add comments to make it clearer. #1569

Merged
merged 1 commit into from
May 14, 2019
Merged
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
24 changes: 20 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
# Build stage - Use a full build environment to create a static binary
FROM golang:1.11
WORKDIR /go/src/github.com/OpenBazaar/openbazaar-go
COPY . .
RUN go build --ldflags '-extldflags "-static"' -o /opt/openbazaard .
COPY . /go/src/github.com/OpenBazaar/openbazaar-go
RUN go build --ldflags '-extldflags "-static"' -o /opt/openbazaard /go/src/github.com/OpenBazaar/openbazaar-go

# Final state - Create image containing nothing but the openbazaard binary and
# some base settings
FROM openbazaar/base:v1.0.0

# Document ports in use
# 4002 - HTTP(s) API
# 4001 - libp2p/IPFS TCP port
# 9005 - libp2p/IPFS websocket port
EXPOSE 4001 4002 9005
ENTRYPOINT ["/opt/openbazaard"]

# Define a volume to perist data to. This data contains all the important
# elements defining a peer so it must be durable as long as the identity exists
VOLUME /var/lib/openbazaar

# Tell the image what to execute by default. We start a mainnet OB server
# that uses the defined volume for node data
ENTRYPOINT ["/opt/openbazaard"]
CMD ["start", "-d", "/var/lib/openbazaar"]

# Copy the compiled binary into this image. It's COPY'd last since the rest of
# this stage rarely changes while the binary changes every commit
COPY --from=0 /opt/openbazaard /opt/openbazaard