Skip to content

Commit

Permalink
[NOD-495] Update dockerfile and initialize go.mod
Browse files Browse the repository at this point in the history
  • Loading branch information
svarogg committed Dec 17, 2019
1 parent b42d909 commit 00dd980
Show file tree
Hide file tree
Showing 3 changed files with 280 additions and 4 deletions.
18 changes: 14 additions & 4 deletions docker/Dockerfile
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"]
12 changes: 12 additions & 0 deletions go.mod
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
Loading

0 comments on commit 00dd980

Please sign in to comment.