Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
521b206994 | |||
551f2762b0 | |||
3356bd6f14 | |||
f58a2d44f7 | |||
436f686e56 |
@ -2,9 +2,11 @@ name: Build Docker Image
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
# Only build on tags (like v1.0.0)
|
branches:
|
||||||
tags:
|
- master
|
||||||
- "v*"
|
# Renovate will push updates as commits
|
||||||
|
paths:
|
||||||
|
- "Dockerfile"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-docker:
|
build-docker:
|
||||||
@ -13,7 +15,7 @@ jobs:
|
|||||||
image: catthehacker/ubuntu:act-latest
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# 1. Checkout the repo
|
# 1. Checkout repository
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
@ -23,7 +25,7 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
# 3. Log in to your registry
|
# 3. Login to your registry
|
||||||
- name: Login to Docker registry
|
- name: Login to Docker registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@ -31,12 +33,18 @@ jobs:
|
|||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
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
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: ${{ env.tags }}
|
||||||
git.comprofix.com/mmckinnon/debian-runner:latest
|
|
||||||
git.comprofix.com/mmckinnon/debian-runner:${{ github.ref_name }}
|
|
||||||
|
70
Dockerfile
70
Dockerfile
@ -1,61 +1,69 @@
|
|||||||
# ==============================
|
# =========================
|
||||||
# Stage 1: Builder
|
# Stage 1: Builder
|
||||||
# ==============================
|
# =========================
|
||||||
FROM debian:trixie-slim@sha256:c85a2732e97694ea77237c61304b3bb410e0e961dd6ee945997a06c788c545bb AS builder
|
FROM debian:trixie-slim@sha256:c2880112cc5c61e1200c26f106e4123627b49726375eb5846313da9cca117337 AS builder
|
||||||
|
|
||||||
# Set environment variables for noninteractive install
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive \
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
LANG=C.UTF-8
|
LANG=C.UTF-8
|
||||||
|
|
||||||
# Install build and runtime dependencies
|
# Install build dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
python3 python3-venv build-essential \
|
curl \
|
||||||
curl git bash openssh-client \
|
git \
|
||||||
ruby-full zlib1g-dev libffi-dev libssl-dev ca-certificates \
|
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/*
|
&& 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 - \
|
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||||
&& apt-get install -y nodejs \
|
&& apt-get install -y nodejs \
|
||||||
&& npm install -g npm \
|
&& npm install -g npm \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Ruby gems: Jekyll and Bundler
|
|
||||||
RUN gem install bundler jekyll
|
|
||||||
|
|
||||||
# Create Python virtual environment for Ansible
|
# Create Python virtual environment for Ansible
|
||||||
RUN python3 -m venv /opt/venv \
|
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
|
FROM debian:trixie-slim@sha256:c2880112cc5c61e1200c26f106e4123627b49726375eb5846313da9cca117337
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive \
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
LANG=C.UTF-8 \
|
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 \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
python3 python3-venv \
|
bash \
|
||||||
curl git bash openssh-client \
|
openssh-client \
|
||||||
ruby-full ca-certificates \
|
ca-certificates \
|
||||||
|
iputils-ping \
|
||||||
|
python3 \
|
||||||
|
python3-venv \
|
||||||
|
ruby-full \
|
||||||
nodejs \
|
nodejs \
|
||||||
|
git \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& 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 /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
|
WORKDIR /workspace
|
||||||
|
|
||||||
# Default shell
|
# Default shell
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
# Expose environment for scripts
|
|
||||||
ENV PATH="/opt/venv/bin:/usr/local/bundle/bin:$PATH"
|
|
||||||
|
Reference in New Issue
Block a user