Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve Dockerfile #197

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "daily"
22 changes: 14 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
FROM ubuntu:24.04@sha256:562456a05a0dbd62a671c1854868862a4687bf979a96d48ae8e766642cd911e8 as runtime
ENV DEBIAN_FRONTEND=noninteractive
COPY docker/01_nodoc /etc/dpkg/dpkg.cfg.d/
RUN apt-get update \
&& apt-get install -y ca-certificates curl gnupg lsb-release jq \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce docker-ce-cli containerd.io
ADD entrypoint.sh /entrypoint.sh
&& apt-get update -o Dir::Etc::sourcelist="sources.list.d/docker.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" \
&& apt-get install -y docker-ce docker-ce-cli containerd.io \
&& apt-get remove -y curl gnupg lsb-release \
&& rm /usr/libexec/docker/cli-plugins/docker-compose \
&& apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

FROM runtime as testEnv
RUN apt-get install -y coreutils bats
ADD test.bats /test.bats
ADD mock.sh /usr/local/mock/docker
ADD mock.sh /usr/local/mock/date
FROM runtime AS testEnv
RUN apt-get install -y coreutils bats \
&& apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
COPY test.bats /test.bats
COPY mock.sh /usr/local/mock/docker
COPY mock.sh /usr/local/mock/date
RUN /test.bats

FROM runtime
11 changes: 11 additions & 0 deletions docker/01_nodoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# /etc/dpkg/dpkg.cfg.d/01_nodoc

# Delete locales
path-exclude=/usr/share/locale/*;

# Delete man pages
path-exclude=/usr/share/man/*;

# Delete docs
path-exclude=/usr/share/doc/*;
path-include=/usr/share/doc/*/copyright;