diff --git a/Dockerfile b/Dockerfile index f976ca5..4f903d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,61 +1,48 @@ -# ============================== +############################## # Stage 1: Builder -# ============================== -FROM debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb AS builder +############################## +FROM debian:trixie-slim AS builder -# Set environment variables for noninteractive install -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive -# Install build and runtime dependencies +# Install build dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ - python3 python3-venv build-essential \ - curl git bash openssh-client \ - ruby-full zlib1g-dev libffi-dev libssl-dev ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -# Install Node.js 22 (latest patch for 22.x) -RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ - && apt-get install -y nodejs \ - && npm install -g npm \ - && rm -rf /var/lib/apt/lists/* - -# Install Ruby gems: Jekyll and Bundler -RUN gem install bundler jekyll - -# Create Python virtual environment for Ansible -RUN python3 -m venv /opt/venv \ - && /opt/venv/bin/pip install --no-cache-dir --upgrade pip ansible==8.* - -# ============================== -# Stage 2: Runtime -# ============================== -FROM debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb - -# Set environment variables -ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - PATH=/usr/local/bundle/bin:/opt/venv/bin:$PATH - -# Install minimal runtime dependencies -RUN apt-get update && apt-get install -y --no-install-recommends \ - python3 python3-venv \ - curl git bash openssh-client \ - ruby-full ca-certificates \ + build-essential \ + curl \ + ca-certificates \ + python3 \ + python3-venv \ + python3-pip \ + ruby-full \ nodejs \ - && rm -rf /var/lib/apt/lists/* + git \ + && rm -rf /var/lib/apt/lists/* + +# Create a Python virtual environment (example usage) +RUN python3 -m venv /opt/venv + +############################## +# Stage 2: Runtime +############################## +FROM debian:trixie-slim + +ENV DEBIAN_FRONTEND=noninteractive + +# Install only runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + python3 \ + ruby-full \ + nodejs \ + git \ + && rm -rf /var/lib/apt/lists/* # Copy built tools from builder COPY --from=builder /opt/venv /opt/venv -COPY --from=builder /usr/local/bundle /usr/local/bundle -COPY --from=builder /usr/lib/node_modules /usr/lib/node_modules -COPY --from=builder /usr/bin/node /usr/bin/node -# Create workspace +# Set Python virtual environment path +ENV PATH="/opt/venv/bin:$PATH" + WORKDIR /workspace -# Default shell -SHELL ["/bin/bash", "-c"] - -# Expose environment for scripts -ENV PATH="/opt/venv/bin:/usr/local/bundle/bin:$PATH" +CMD ["bash"]