This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLEANUP: Tweak Dockerfile a little and add comments to make it clearer.
- Loading branch information
1 parent
c57238b
commit 87e2bc0
Showing
1 changed file
with
20 additions
and
4 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
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 |