[NOD-352] Create a Dockerfile for APIServer (#428)

* [NOD-352] Created a Dockerfile for APIServer.

* [NOD-352] Removed unnecessary testing stuff from the APIServer and DNSSeeder Dockerfiles.
This commit is contained in:
stasatdaglabs 2019-10-13 14:07:44 +03:00 committed by Dan Aharoni
parent 982340456d
commit 089cee0e1d
4 changed files with 32 additions and 16 deletions

View File

@ -0,0 +1,28 @@
# -- multistage docker build: stage #1: build stage
FROM golang:1.13-alpine AS build
RUN mkdir -p /go/src/github.com/daglabs/btcd
WORKDIR /go/src/github.com/daglabs/btcd
RUN apk add --no-cache curl git
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN cd apiserver && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o apiserver .
# --- multistage docker build: stage #2: runtime image
FROM alpine
WORKDIR /app
RUN apk add --no-cache tini
COPY --from=build /go/src/github.com/daglabs/btcd/apiserver/ /app/
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/apiserver"]

View File

@ -25,5 +25,4 @@ RUN apk add --no-cache tini
COPY --from=build /go/src/github.com/daglabs/btcd/cmd/txgen/txgen /app/
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/txgen"]

View File

@ -5,12 +5,7 @@ RUN mkdir -p /go/src/github.com/daglabs/btcd
WORKDIR /go/src/github.com/daglabs/btcd
RUN apk add --no-cache curl git openssh binutils gcc musl-dev
RUN go get -u golang.org/x/lint/golint \
github.com/kisielk/errcheck \
github.com/opennota/check/cmd/aligncheck \
github.com/opennota/check/cmd/structcheck \
github.com/opennota/check/cmd/varcheck
RUN apk add --no-cache curl git
COPY go.mod .
COPY go.sum .
@ -19,20 +14,15 @@ RUN go mod download
COPY . .
RUN go vet ./...
# RUN aligncheck ./...
# RUN structcheck -e ./...
# RUN varcheck -e ./...
RUN cd dnsseeder && 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 ca-certificates tini
RUN apk add --no-cache tini
COPY --from=build /go/src/github.com/daglabs/btcd/dnsseeder/ /app/
USER nobody
CMD [ "/app/dnsseeder", "-H", "dnsseed.my.home", "-n", "192.168.16.104", "-l", "0.0.0.0:53", "-s", "localhost", "--testnet" ]
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/dnsseeder"]

View File

@ -25,5 +25,4 @@ RUN apk add --no-cache tini
COPY --from=build /go/src/github.com/daglabs/btcd/mining/simulator/mining_simulator /app/
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/app/mining_simulator"]