Files
peikarband/docker/Dockerfile.base
Ehsan.Asadi 826447e9a2
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/manual/woodpecker Pipeline was successful
feat: add tini to base image
Now base image includes:
 Python 3.11
 Node.js 20
 bun, npm
 Build tools (gcc, g++, make)
 Runtime essentials (curl, ca-certificates, git)
 tini (init system)

Runtime Dockerfile needs ZERO apt installs!
2025-12-30 22:17:13 +03:30

72 lines
2.0 KiB
Docker

# Peikarband Base Image
# Pre-built image with Python, Node.js, bun, and build tools
#
# Usage:
# Build: docker build -f docker/Dockerfile.base -t hub.peikarband.ir/peikarband/base:latest .
# Or use Woodpecker: trigger .woodpecker-base.yml pipeline
#
# This image is built once and reused by all Peikarband projects
ARG PYTHON_VERSION=3.11
ARG NODE_VERSION=20
FROM python:${PYTHON_VERSION}-slim
LABEL maintainer="Peikarband Team <dev@peikarband.ir>"
LABEL org.opencontainers.image.title="Peikarband Base"
LABEL org.opencontainers.image.description="Base image with Python, Node.js, bun, and build tools"
WORKDIR /build
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
make \
curl \
gnupg \
ca-certificates \
unzip \
git \
tini \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js
ARG NODE_VERSION
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& npm config set fetch-retry-mintimeout 20000 \
&& npm config set fetch-retry-maxtimeout 120000 \
&& npm config set fetch-retries 5 \
&& npm config set fetch-timeout 300000 \
&& npm config set registry https://registry.npmjs.org/
# Install bun (required by Reflex for frontend build)
# Retry mechanism for network issues
RUN set -ex && \
for i in 1 2 3 4 5; do \
curl -fsSL https://bun.sh/install | bash && break || \
(echo "Attempt $i failed, retrying in 5 seconds..." && sleep 5); \
done || (echo "Failed to install bun after 5 attempts" && exit 1)
# Add bun to PATH
ENV PATH="/root/.bun/bin:${PATH}"
# Upgrade pip, setuptools, wheel
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# Verify installations
RUN python --version && \
node --version && \
npm --version && \
bun --version && \
pip --version
# Set working directory
WORKDIR /build
# Default command
CMD ["/bin/bash"]