Skip to content

Commit

Permalink
feat(docker): use alpine for the base image
Browse files Browse the repository at this point in the history
Use alpine for our base image since this reduces the container size by
about half. Plus, most of this is just Python, bash, and make scripting
anyway. Nothing Ubuntu specific anymore.

Signed-off-by: Randolph Sapp <[email protected]>
  • Loading branch information
StaticRocket committed Dec 16, 2024
1 parent 02cd841 commit 23fbd1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
25 changes: 7 additions & 18 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com

FROM debian:stable-slim
FROM alpine:3

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
--no-install-recommends \
RUN apk add --no-cache \
bash \
dumb-init \
git \
gosu \
make \
python3-pip \
py3-pip \
ripgrep \
shadow \
su-exec \
zip \
&& echo "**** create abc user and make our folders ****" \
&& useradd -u 1000 -U -d /config -s /bin/false abc \
&& usermod -G users abc \
&& mkdir /build && chown abc:abc /build \
&& mkdir /config && chown abc:abc /config \
&& echo "**** cleanup ****" \
&& apt-get autoremove \
&& apt-get clean \
&& rm -rf \
/tmp/* \
/var/cache/debconf/*-old \
/var/lib/apt/lists/* \
/var/lib/dpkg/status-old \
/var/lib/sgml-base/supercatalog.old \
/var/log/apt/term.log \
/var/tmp/*
&& mkdir /config && chown abc:abc /config

RUN --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \
python3 -m pip install -r /tmp/requirements.txt --no-cache-dir \
Expand Down
2 changes: 1 addition & 1 deletion docker/root/init
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ fi
if [ "$(id -u)" == "$(id -u abc)" ]; then
exec dumb-init -- "$@"
else
exec dumb-init -- gosu abc "$@"
exec dumb-init -- su-exec abc:abc "$@"
fi

0 comments on commit 23fbd1a

Please sign in to comment.