Skip to content

Commit

Permalink
Add minimal production Dockerfile using Distroless for reduced image …
Browse files Browse the repository at this point in the history
…size and improved security (#1338)
  • Loading branch information
jiangdeyan authored Jan 25, 2024
1 parent 129fc02 commit 9e1244d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docker/Dockerfile_production_minimal
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 iLogtail Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM --platform=$TARGETPLATFORM debian:bookworm as build
ARG VERSION=2.0.0
ARG TARGETPLATFORM
ARG UID=65532
WORKDIR /usr/local
COPY dist/ilogtail-${VERSION}.linux-*.tar.gz .
RUN tar -xzf ilogtail-${VERSION}.linux-${TARGETPLATFORM##*/}.tar.gz
RUN mv /usr/local/ilogtail-${VERSION} /usr/local/ilogtail && \
mkdir /usr/local/ilogtail/checkpoint && \
cp example_config/start_with_docker/ilogtail_config.json /usr/local/ilogtail/ && \
chmod 755 /usr/local/ilogtail/ilogtail

FROM gcr.lank8s.cn/distroless/cc-debian12:latest
LABEL org.opencontainers.image.authors="[email protected], [email protected]"

COPY --from=build /usr/lib/x86_64-linux-gnu/libuuid.so.1.3.0 /lib/x86_64-linux-gnu/libuuid.so.1

ARG HOST_OS=Linux
ARG VERSION=2.0.0
ARG TARGETPLATFORM

COPY --from=build --chown=$UID:$UID /usr/local/ilogtail /usr/local/ilogtail

WORKDIR /usr/local/ilogtail

ENV HTTP_PROBE_PORT=7953 \
ALIYUN_LOGTAIL_USER_DEFINED_ID=default \
docker_file_cache_path=checkpoint/docker_path_config.json
CMD ["/usr/local/ilogtail/ilogtail"]

0 comments on commit 9e1244d

Please sign in to comment.