-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NOD-495] Update dockerfile and initialize go.mod
- Loading branch information
Showing
3 changed files
with
280 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,28 +1,38 @@ | ||
# -- multistage docker build: stage #1: build stage | ||
FROM golang:1.13-alpine AS build | ||
ARG KASPAD_VERSION=latest | ||
|
||
RUN mkdir -p /go/src/github.com/kaspanet/kaspad | ||
RUN mkdir -p /go/src/github.com/kaspanet/dnsseeder | ||
|
||
WORKDIR /go/src/github.com/kaspanet/kaspad | ||
WORKDIR /go/src/github.com/kaspanet/dnsseeder | ||
|
||
RUN apk add --no-cache curl git | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
|
||
# For development it's useful to have kaspad from filesystem, but for deployment | ||
# we should use the one in github | ||
RUN go mod edit -dropreplace github.com/kaspanet/kaspad | ||
RUN go mod edit -require github.com/kaspanet/kaspad@$KASPAD_VERSION | ||
RUN cp go.mod go.mod.bu | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN cd dnsseeder && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o dnsseeder . | ||
# Restore go.mod because `COPY . .` overwrote it | ||
RUN mv go.mod.bu go.mod | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o dnsseeder . | ||
|
||
# --- multistage docker build: stage #2: runtime image | ||
FROM alpine | ||
WORKDIR /app | ||
|
||
RUN apk add --no-cache tini | ||
|
||
COPY --from=build /go/src/github.com/kaspanet/kaspad/dnsseeder/ /app/ | ||
COPY --from=build /go/src/github.com/kaspanet/dnsseeder/ /app/ | ||
|
||
ENTRYPOINT ["/sbin/tini", "--"] | ||
CMD ["/app/dnsseeder"] |
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,12 @@ | ||
module github.com/kaspanet/dnsseeder | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/jessevdk/go-flags v1.4.0 | ||
github.com/kaspanet/kaspad v0.0.0-00010101000000-000000000000 | ||
github.com/miekg/dns v1.1.25 | ||
github.com/pkg/errors v0.8.1 | ||
) | ||
|
||
replace github.com/kaspanet/kaspad => ../kaspad |
Oops, something went wrong.