Skip to content

Commit

Permalink
Use alpine instead of python:3-slim for lighter image
Browse files Browse the repository at this point in the history
  • Loading branch information
nusantara-self committed Feb 9, 2025
1 parent 23dc46d commit 4886aec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3-slim
FROM python:3-alpine

# Upgrade pip to latest version
RUN pip install --no-cache-dir --upgrade pip
Expand All @@ -15,23 +15,23 @@ ENV DOCKER_CHANNEL=stable
ENV DOCKER_VERSION=27.5.1

# Install required packages and Docker CLI
RUN apt-get update && \
apt-get install -y --no-install-recommends \
RUN apk add --no-cache \
iptables \
wget \
ca-certificates \
git && \
update-alternatives --set iptables /usr/sbin/iptables-legacy && \
rm -rf /var/lib/apt/lists/* && \
git \
bash && \
update-ca-certificates && \
wget -q -O - "https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" | \
tar -xzC /usr/local/bin/ --strip-components 1 && \
addgroup --system dockremap && \
adduser --system --ingroup dockremap dockremap && \
addgroup -S dockremap && \
adduser -S -G dockremap dockremap && \
echo 'dockremap:165536:65536' >> /etc/subuid && \
echo 'dockremap:165536:65536' >> /etc/subgid

# Copy the entrypoint script
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh

# volume declaration for Docker data
VOLUME ["/var/lib/docker"]
Expand Down

0 comments on commit 4886aec

Please sign in to comment.