mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-07 14:46:44 +00:00
[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:
parent
982340456d
commit
089cee0e1d
28
apiserver/docker/Dockerfile
Normal file
28
apiserver/docker/Dockerfile
Normal 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"]
|
@ -25,5 +25,4 @@ RUN apk add --no-cache tini
|
|||||||
COPY --from=build /go/src/github.com/daglabs/btcd/cmd/txgen/txgen /app/
|
COPY --from=build /go/src/github.com/daglabs/btcd/cmd/txgen/txgen /app/
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
|
||||||
CMD ["/app/txgen"]
|
CMD ["/app/txgen"]
|
||||||
|
@ -5,12 +5,7 @@ RUN mkdir -p /go/src/github.com/daglabs/btcd
|
|||||||
|
|
||||||
WORKDIR /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 apk add --no-cache curl git
|
||||||
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
|
|
||||||
|
|
||||||
COPY go.mod .
|
COPY go.mod .
|
||||||
COPY go.sum .
|
COPY go.sum .
|
||||||
@ -19,20 +14,15 @@ RUN go mod download
|
|||||||
|
|
||||||
COPY . .
|
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 .
|
RUN cd dnsseeder && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o dnsseeder .
|
||||||
|
|
||||||
# --- multistage docker build: stage #2: runtime image
|
# --- multistage docker build: stage #2: runtime image
|
||||||
FROM alpine
|
FROM alpine
|
||||||
WORKDIR /app
|
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/
|
COPY --from=build /go/src/github.com/daglabs/btcd/dnsseeder/ /app/
|
||||||
|
|
||||||
USER nobody
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
CMD [ "/app/dnsseeder", "-H", "dnsseed.my.home", "-n", "192.168.16.104", "-l", "0.0.0.0:53", "-s", "localhost", "--testnet" ]
|
CMD ["/app/dnsseeder"]
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
|
||||||
|
@ -25,5 +25,4 @@ RUN apk add --no-cache tini
|
|||||||
COPY --from=build /go/src/github.com/daglabs/btcd/mining/simulator/mining_simulator /app/
|
COPY --from=build /go/src/github.com/daglabs/btcd/mining/simulator/mining_simulator /app/
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
|
||||||
CMD ["/app/mining_simulator"]
|
CMD ["/app/mining_simulator"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user