3 Commits

Author SHA1 Message Date
3356bd6f14 chore: add git package to second stage
All checks were successful
Build Docker Image / build-docker (push) Successful in 9m54s
2025-08-31 19:35:07 +10:00
f58a2d44f7 chore: clean image
All checks were successful
Build Docker Image / build-docker (push) Successful in 3m53s
2025-08-31 19:16:31 +10:00
436f686e56 chore: remove jekyll and bundler install
All checks were successful
Build Docker Image / build-docker (push) Successful in 1m15s
2025-08-31 17:11:19 +10:00
2 changed files with 54 additions and 38 deletions

View File

@ -2,9 +2,11 @@ name: Build Docker Image
on:
push:
# Only build on tags (like v1.0.0)
tags:
- "v*"
branches:
- master
# Renovate will push updates as commits
paths:
- "Dockerfile"
jobs:
build-docker:
@ -13,7 +15,7 @@ jobs:
image: catthehacker/ubuntu:act-latest
steps:
# 1. Checkout the repo
# 1. Checkout repository
- name: Checkout repository
uses: actions/checkout@v5
with:
@ -23,7 +25,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 3. Log in to your registry
# 3. Login to your registry
- name: Login to Docker registry
uses: docker/login-action@v3
with:
@ -31,12 +33,18 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
# 4. Build and push Docker image
# 4. Define timestamp tag
- name: Set Docker image tags
id: docker_tags
run: |
TIMESTAMP=$(date +'%Y.%m.%d-%H%M%S')
echo "tags=git.comprofix.com/mmckinnon/debian-latest:latest,git.comprofix.com/mmckinnon/debian-latest:$TIMESTAMP" >> $GITHUB_ENV
# 5. Build & push Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
git.comprofix.com/mmckinnon/debian-runner:latest
git.comprofix.com/mmckinnon/debian-runner:${{ github.ref_name }}
tags: ${{ env.tags }}

View File

@ -1,61 +1,69 @@
# ==============================
# =========================
# Stage 1: Builder
# ==============================
# =========================
FROM debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb AS builder
# Set environment variables for noninteractive install
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8
# 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 \
curl \
git \
bash \
openssh-client \
ca-certificates \
procps \
iproute2 \
netcat-traditional \
unzip \
iputils-ping \
python3 \
python3-venv \
build-essential \
zlib1g-dev \
libffi-dev \
libssl-dev \
ruby-full \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 22 (latest patch for 22.x)
# Install Node.js 22
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.*
&& /opt/venv/bin/pip install --no-cache-dir --upgrade pip ansible
# ==============================
# Stage 2: Runtime
# ==============================
# =========================
# Stage 2: Final runtime image
# =========================
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
PATH=/opt/venv/bin:$PATH
# Install minimal runtime dependencies
# Install runtime dependencies only
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-venv \
curl git bash openssh-client \
ruby-full ca-certificates \
bash \
openssh-client \
ca-certificates \
iputils-ping \
python3 \
python3-venv \
ruby-full \
nodejs \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy built tools from builder
# Copy built Python venv 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 working directory
WORKDIR /workspace
# Default shell
SHELL ["/bin/bash", "-c"]
# Expose environment for scripts
ENV PATH="/opt/venv/bin:/usr/local/bundle/bin:$PATH"