-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add minimal production Dockerfile using Distroless for reduced image …
…size and improved security (#1338)
- Loading branch information
1 parent
129fc02
commit 9e1244d
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |