File tree Expand file tree Collapse file tree 6 files changed +82
-12
lines changed
Expand file tree Collapse file tree 6 files changed +82
-12
lines changed Original file line number Diff line number Diff line change 1- FROM centos:7 as builder
1+ FROM centos:7 AS builder
22
33ARG CARGO_PROFILE
44ARG FEATURES
55ARG OUTPUT_DIR
66
7- ENV LANG en_US.utf8
7+ ENV LANG= en_US.utf8
88WORKDIR /greptimedb
99
1010# Install dependencies
@@ -22,7 +22,7 @@ RUN unzip protoc-3.15.8-linux-x86_64.zip -d /usr/local/
2222# Install Rust
2323SHELL ["/bin/bash" , "-c" ]
2424RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
25- ENV PATH /usr/local/bin:/root/.cargo/bin/:$PATH
25+ ENV PATH= /usr/local/bin:/root/.cargo/bin/:$PATH
2626
2727# Build the project in release mode.
2828RUN --mount=target=.,rw \
@@ -33,7 +33,7 @@ RUN --mount=target=.,rw \
3333 TARGET_DIR=/out/target
3434
3535# Export the binary to the clean image.
36- FROM centos:7 as base
36+ FROM centos:7 AS base
3737
3838ARG OUTPUT_DIR
3939
@@ -45,7 +45,7 @@ RUN yum install -y epel-release \
4545
4646WORKDIR /greptime
4747COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/
48- ENV PATH /greptime/bin/:$PATH
48+ ENV PATH= /greptime/bin/:$PATH
4949
5050ENV MALLOC_CONF="prof:true,prof_active:false"
5151
Original file line number Diff line number Diff line change 1+ FROM ubuntu:22.04 AS builder
2+
3+ ARG CARGO_PROFILE
4+ ARG FEATURES
5+ ARG OUTPUT_DIR
6+
7+ ENV LANG=en_US.utf8
8+ WORKDIR /greptimedb
9+
10+ RUN apt-get update && \
11+ DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
12+
13+ # Install dependencies.
14+ RUN --mount=type=cache,target=/var/cache/apt \
15+ apt-get update && apt-get install -y \
16+ libssl-dev \
17+ protobuf-compiler \
18+ curl \
19+ git \
20+ build-essential \
21+ pkg-config
22+
23+ # Install Rust.
24+ SHELL ["/bin/bash" , "-c" ]
25+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
26+ ENV PATH=/root/.cargo/bin/:$PATH
27+
28+ # Build the project in release mode.
29+ RUN --mount=target=. \
30+ --mount=type=cache,target=/root/.cargo/registry \
31+ make build \
32+ CARGO_PROFILE=${CARGO_PROFILE} \
33+ FEATURES=${FEATURES} \
34+ TARGET_DIR=/out/target
35+
36+ # Export the binary to the clean distroless image.
37+ FROM gcr.io/distroless/cc-debian12:latest AS base
38+
39+ ARG OUTPUT_DIR
40+
41+ # Copy required library dependencies
42+ COPY --from=ubuntu:22.04 /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1
43+ COPY --from=busybox:1.31.1 /bin/busybox /bin/busybox
44+
45+ WORKDIR /greptime
46+ COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/greptime
47+ ENV PATH=/greptime/bin/:$PATH
48+
49+ ENTRYPOINT ["greptime" ]
Original file line number Diff line number Diff line change 1- FROM ubuntu:22.04 as builder
1+ FROM ubuntu:22.04 AS builder
22
33ARG CARGO_PROFILE
44ARG FEATURES
55ARG OUTPUT_DIR
66
7- ENV LANG en_US.utf8
7+ ENV LANG= en_US.utf8
88WORKDIR /greptimedb
99
1010RUN apt-get update && \
@@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
2323# Install Rust.
2424SHELL ["/bin/bash" , "-c" ]
2525RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
26- ENV PATH /root/.cargo/bin/:$PATH
26+ ENV PATH= /root/.cargo/bin/:$PATH
2727
2828# Build the project in release mode.
2929RUN --mount=target=. \
@@ -35,7 +35,7 @@ RUN --mount=target=. \
3535
3636# Export the binary to the clean image.
3737# TODO(zyy17): Maybe should use the more secure container image.
38- FROM ubuntu:22.04 as base
38+ FROM ubuntu:22.04 AS base
3939
4040ARG OUTPUT_DIR
4141
@@ -45,7 +45,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get \
4545
4646WORKDIR /greptime
4747COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/
48- ENV PATH /greptime/bin/:$PATH
48+ ENV PATH= /greptime/bin/:$PATH
4949
5050ENV MALLOC_CONF="prof:true,prof_active:false"
5151
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ ARG TARGETARCH
1313
1414ADD $TARGETARCH/greptime /greptime/bin/
1515
16- ENV PATH /greptime/bin/:$PATH
16+ ENV PATH= /greptime/bin/:$PATH
1717
1818ENV MALLOC_CONF="prof:true,prof_active:false"
1919
Original file line number Diff line number Diff line change 1+ FROM gcr.io/distroless/cc-debian12:latest
2+
3+ # The root path under which contains all the dependencies to build this Dockerfile.
4+ ARG DOCKER_BUILD_ROOT=.
5+ # The binary name of GreptimeDB executable.
6+ # Defaults to "greptime", but sometimes in other projects it might be different.
7+ ARG TARGET_BIN=greptime
8+
9+ # Copy required library dependencies
10+ COPY --from=ubuntu:22.04 /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1
11+ COPY --from=busybox:1.31.1 /bin/busybox /bin/busybox
12+
13+ ARG TARGETARCH
14+
15+ ADD $TARGETARCH/$TARGET_BIN /greptime/bin/greptime
16+
17+ ENV PATH=/greptime/bin/:$PATH
18+
19+ ENV TARGET_BIN=$TARGET_BIN
20+
21+ ENTRYPOINT ["greptime" ]
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ ARG TARGETARCH
1414
1515ADD $TARGETARCH/$TARGET_BIN /greptime/bin/
1616
17- ENV PATH /greptime/bin/:$PATH
17+ ENV PATH= /greptime/bin/:$PATH
1818
1919ENV TARGET_BIN=$TARGET_BIN
2020
You can’t perform that action at this time.
0 commit comments