-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (45 loc) · 1.13 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
#
# Arkeo Directory
#
ARG GO_VERSION="1.19"
#
# Build
#
FROM golang:${GO_VERSION} as builder
ARG GIT_VERSION
ARG GIT_COMMIT
ENV GOBIN=/go/bin
ENV GOPATH=/go
ENV CGO_ENABLED=0
ENV GOOS=linux
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TAG=latest
RUN make install
# docs
FROM golang:${GO_VERSION} as docs
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y curl nodejs npm
RUN curl -sLf https://github.com/go-swagger/go-swagger/releases/download/v0.30.4/swagger_linux_amd64 -o /usr/local/bin/swagger
RUN chmod +x /usr/local/bin/swagger
RUN npm install -g redoc-cli
COPY --from=builder /app /app
WORKDIR /app
RUN make swagger-html
# final
FROM ubuntu:kinetic
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y jq curl htop vim ca-certificates
RUN update-ca-certificates
# clean up
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
# binaries
COPY --from=builder /go/bin/indexer /go/bin/api /usr/bin/
COPY --from=docs /app/docs/swagger.html /var/www/html/index.html
COPY --from=docs /app/docs/swagger.yaml /var/www/html/swagger.yaml
COPY scripts /scripts
CMD ["indexer"]