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

Commit

Permalink
CLEANUP: Tweak Dockerfile a little and add comments to make it clearer.
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-smith committed May 3, 2019
1 parent c57238b commit 87e2bc0
Showing 1 changed file with 20 additions and 4 deletions.
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

0 comments on commit 87e2bc0

Please sign in to comment.