-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (40 loc) · 1.56 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Dockerfile for Payment Channel Participants
# for caching purposes we separate the build stage from the runtime stage
# 1. build stage
FROM golang:1.20.5-bullseye as builder
ENV GODEBUG netdns=cgo
WORKDIR $GOPATH/src/github.com/dancodery/algorand-state-channels
# copy mod.go and sum.go to improve caching
COPY go.mod go.sum ./
# download dependencies
RUN go mod download
# copy only necessary files to improve caching
COPY cmd/ascli/ ./cmd/ascli/
COPY cmd/ascli/ $GOPATH/src/github.com/dancodery/algorand-state-channels/cmd/ascli/
COPY asrpc/ $GOPATH/src/github.com/dancodery/algorand-state-channels/asrpc/
COPY payment/ $GOPATH/src/github.com/dancodery/algorand-state-channels/payment/
COPY payment/testing/ $GOPATH/src/github.com/dancodery/algorand-state-channels/payment/testing/
COPY payment/build_contracts/ /smart_contracts/
COPY asd.go server.go client.go rpcserver.go config.go watchtower.go $GOPATH/src/github.com/dancodery/algorand-state-channels/
# build binaries
RUN go build -o /bin/ascli cmd/ascli/***
RUN go build -o /bin/asd
# 2. run stage
FROM debian:bullseye as final
# needed for docker network
ENV GODEBUG netdns=cgo
# install linux packages
RUN \
--mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y \
netcat-openbsd \
jq \
&& rm -rf /var/lib/apt/lists/*
# copy binaries to final image
COPY --from=builder /smart_contracts/ /smart_contracts/
COPY --from=builder /bin/ascli /bin/
COPY --from=builder /bin/asd /bin/
# expose p2p port
EXPOSE 28547
# run the server
CMD /bin/asd