forked from tonindexer/anton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (43 loc) · 1.88 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
55
56
57
58
59
60
61
62
63
64
# syntax=docker/dockerfile:1.5-labs
FROM alpine:3 AS emulator-builder
# build emulator libraries
RUN apk add --no-cache make cmake gcc g++ musl-dev zlib-dev openssl-dev linux-headers git
ADD --keep-git-dir=true https://github.com/ton-blockchain/ton.git /ton
RUN cd /ton && git submodule update --init --recursive
RUN apk add --no-cache openblas-dev libmicrohttpd-dev
RUN mkdir build && (cd build && cmake ../ton -DCMAKE_BUILD_TYPE=Release && cmake --build . --target emulator -- -j 8)
RUN mkdir /output && cp build/emulator/libemulator.so /output
# build
FROM golang:1.19-alpine AS builder
RUN apk add --no-cache build-base
#prepare env
WORKDIR /go/src/github.com/tonindexer/anton
RUN go install github.com/swaggo/swag/cmd/[email protected]
# download dependencies
COPY go.mod go.sum /go/src/github.com/tonindexer/anton/
RUN go mod download
# copy application code
COPY migrations /go/src/github.com/tonindexer/anton/migrations
COPY cmd /go/src/github.com/tonindexer/anton/cmd
COPY addr /go/src/github.com/tonindexer/anton/addr
COPY abi /go/src/github.com/tonindexer/anton/abi
COPY internal /go/src/github.com/tonindexer/anton/internal
COPY main.go /go/src/github.com/tonindexer/anton
RUN rm /go/pkg/mod/github.com/tonkeeper/[email protected]/lib/linux/libemulator.so
COPY --from=emulator-builder /output/libemulator.so /lib/libemulator.so
RUN swag init \
--output api/http --generalInfo internal/api/http/controller.go \
--parseDependency --parseInternal
RUN go build -o /anton /go/src/github.com/tonindexer/anton
# application
FROM alpine:3
ENV LISTEN=0.0.0.0:8080
RUN apk add --no-cache libgcc libstdc++
RUN addgroup -S anton && adduser -S anton -G anton
WORKDIR /app
COPY --from=builder /lib/libemulator.so /lib
COPY --from=builder /go/src/github.com/tonindexer/anton/abi/known /var/anton/known
COPY --from=builder /anton /usr/bin/anton
USER anton:anton
EXPOSE 8080
ENTRYPOINT ["/usr/bin/anton"]