github.com/klaytn/klaytn@v1.12.1/Dockerfile (about)

     1  # Global ARGs
     2  ARG DOCKER_BASE_IMAGE=klaytn/build_base:latest
     3  ARG PKG_DIR=/klaytn-docker-pkg
     4  ARG SRC_DIR=/go/src/github.com/klaytn/klaytn
     5  
     6  FROM ${DOCKER_BASE_IMAGE} AS builder
     7  LABEL maintainer="Tony Lee <tony.jm@krustuniverse.com>"
     8  ARG SRC_DIR
     9  ARG PKG_DIR
    10  
    11  ARG KLAYTN_RACE_DETECT=0
    12  ENV KLAYTN_RACE_DETECT=$KLAYTN_RACE_DETECT
    13  
    14  ARG KLAYTN_STATIC_LINK=0
    15  ENV KLAYTN_STATIC_LINK=$KLAYTN_STATIC_LINK
    16  
    17  ARG KLAYTN_DISABLE_SYMBOL=0
    18  ENV KLAYTN_DISABLE_SYMBOL=$KLAYTN_DISABLE_SYMBOL
    19  
    20  WORKDIR $SRC_DIR
    21  # Cache default $GOMODCACHE
    22  COPY go.mod go.sum ./
    23  RUN --mount=type=cache,target=/go/pkg/mod go mod download -x
    24  
    25  # Cache default $GOCACHE
    26  # First 'make kcn' to populate build cache and then 'make all' in parallel
    27  COPY . .
    28  RUN --mount=type=cache,target=/root/.cache/go-build \
    29      --mount=type=cache,target=/go/pkg/mod \
    30      make kcn && \
    31      make all -j
    32  
    33  FROM --platform=linux/amd64 ubuntu:20.04
    34  ARG SRC_DIR
    35  ARG PKG_DIR
    36  
    37  RUN apt update && \
    38              apt install -yq musl-dev ca-certificates && \
    39              update-ca-certificates && \
    40              mkdir -p $PKG_DIR/conf $PKG_DIR/bin
    41  
    42  # Startup scripts and binaries must be in the same location
    43  COPY --from=builder $SRC_DIR/build/bin/* $PKG_DIR/bin/
    44  COPY --from=builder $SRC_DIR/build/packaging/linux/bin/* $PKG_DIR/bin/
    45  COPY --from=builder $SRC_DIR/build/packaging/linux/conf/* $PKG_DIR/conf/
    46  
    47  ENV PATH=$PKG_DIR/bin:$PATH
    48  
    49  EXPOSE 8551 8552 32323 61001 32323/udp