-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
49 lines (38 loc) · 1.35 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
# Global ARGs
ARG DOCKER_BASE_IMAGE=klaytn/build_base:latest
ARG PKG_DIR=/klaytn-docker-pkg
ARG SRC_DIR=/go/src/github.com/klaytn/klaytn
FROM ${DOCKER_BASE_IMAGE} AS builder
LABEL maintainer="Tony Lee <[email protected]>"
ARG SRC_DIR
ARG PKG_DIR
ARG KAIA_RACE_DETECT=0
ENV KAIA_RACE_DETECT=$KAIA_RACE_DETECT
ARG KAIA_STATIC_LINK=0
ENV KAIA_STATIC_LINK=$KAIA_STATIC_LINK
ARG KAIA_DISABLE_SYMBOL=0
ENV KAIA_DISABLE_SYMBOL=$KAIA_DISABLE_SYMBOL
WORKDIR $SRC_DIR
# Cache default $GOMODCACHE
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download -x
# Cache default $GOCACHE
# First 'make kcn' to populate build cache and then 'make all' in parallel
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
make kcn && \
make all -j
FROM --platform=linux/amd64 ubuntu:20.04
ARG SRC_DIR
ARG PKG_DIR
RUN apt update && \
apt install -yq musl-dev ca-certificates && \
update-ca-certificates && \
mkdir -p $PKG_DIR/conf $PKG_DIR/bin
# Startup scripts and binaries must be in the same location
COPY --from=builder $SRC_DIR/build/bin/* $PKG_DIR/bin/
COPY --from=builder $SRC_DIR/build/packaging/linux/bin/* $PKG_DIR/bin/
COPY --from=builder $SRC_DIR/build/packaging/linux/conf/* $PKG_DIR/conf/
ENV PATH=$PKG_DIR/bin:$PATH
EXPOSE 8551 8552 32323 61001 32323/udp