Skip to content

Commit cad6236

Browse files
committed
Plucky build
1 parent 47a6773 commit cad6236

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

.github/workflows/ubuntu2504.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: ubuntu2504
3+
4+
on:
5+
pull_request:
6+
push:
7+
paths:
8+
- 'ubuntu2504/**'
9+
- '.github/workflows/ubuntu2504.yml'
10+
schedule:
11+
- cron: '10 6,15 * * 1,6'
12+
workflow_dispatch:
13+
14+
permissions: write-all
15+
16+
concurrency:
17+
group: ${{ github.ref }}-${{ github.workflow }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
# Test the image builds and works correctly.
22+
test:
23+
name: Test ubuntu2504
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
os: [ubuntu-22.04]
28+
29+
steps:
30+
- uses: actions/[email protected]
31+
32+
- name: Test building image.
33+
run: cd ubuntu2504 && docker build -t ubuntu2504 .
34+
35+
- name: Run the built image.
36+
run: docker run --name test-container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw ubuntu2504
37+
38+
# If on master branch, build and release image.
39+
release:
40+
name: Release
41+
runs-on: ubuntu-latest
42+
# needs: test
43+
if: github.ref == 'refs/heads/master'
44+
45+
steps:
46+
- uses: actions/checkout@v3
47+
- uses: docker/setup-qemu-action@v2
48+
- uses: docker/[email protected]
49+
50+
- name: Login to DockerHub
51+
uses: docker/[email protected]
52+
with:
53+
username: ${{ secrets.DOCKERHUB_USERNAME }}
54+
password: ${{ secrets.DOCKERHUB_TOKEN }}
55+
56+
- name: Logain to GitHub Container Registry
57+
uses: docker/[email protected]
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.repository_owner }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Build and push image.
64+
uses: docker/[email protected]
65+
with:
66+
context: ubuntu2504/
67+
file: ubuntu2504/Dockerfile
68+
platforms: linux/amd64, linux/arm64, linux/arm64/v8
69+
push: true
70+
tags: |
71+
${{ github.repository }}:ubuntu2504, ${{ github.repository }}:plucky

ubuntu2504/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# syntax=docker/dockerfile:1
2+
FROM ubuntu:plucky
3+
4+
LABEL maintainer="Michael Buluma"
5+
LABEL build_date="2025-12-01"
6+
7+
LABEL org.opencontainers.image.title="Docker Ubuntu Plucky Systemd" \
8+
org.opencontainers.image.description="Ubuntu Container for Ansible Tests." \
9+
org.opencontainers.image.url="https://github.com/buluma/docker-molecule-images/" \
10+
org.opencontainers.image.source="https://github.com/buluma/docker-molecule-images" \
11+
org.opencontainers.image.licenses="Apache-2.0"
12+
13+
ENV container docker
14+
15+
# Enable apt repositories.
16+
RUN sed -i 's/# deb/deb/g' /etc/apt/sources.list
17+
18+
# Enable systemd.
19+
RUN apt-get update ; \
20+
apt-get install -y systemd systemd-sysv ; \
21+
apt-get clean ; \
22+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ; \
23+
cd /lib/systemd/system/sysinit.target.wants/ ; \
24+
ls | grep -v systemd-tmpfiles-setup | xargs rm -f $1 ; \
25+
rm -f /lib/systemd/system/multi-user.target.wants/* ; \
26+
rm -f /etc/systemd/system/*.wants/* ; \
27+
rm -f /lib/systemd/system/local-fs.target.wants/* ; \
28+
rm -f /lib/systemd/system/sockets.target.wants/*udev* ; \
29+
rm -f /lib/systemd/system/sockets.target.wants/*initctl* ; \
30+
rm -f /lib/systemd/system/basic.target.wants/* ; \
31+
rm -f /lib/systemd/system/anaconda.target.wants/* ; \
32+
rm -f /lib/systemd/system/plymouth* ; \
33+
rm -f /lib/systemd/system/systemd-update-utmp*
34+
35+
VOLUME [ "/sys/fs/cgroup" ]
36+
37+
CMD ["/lib/systemd/systemd"]

ubuntu2504/Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
IMG ?= ${{ github.repository }}
2+
TAG ?= $(shell git describe --tags --always --dirty)
3+
DOCKERFILE ?= ubuntu2404/Dockerfile
4+
ARCH ?= linux/amd64
5+
6+
7+
docker-build:
8+
cd ../ && docker build -t ${IMG}:${TAG} -f ${DOCKERFILE} .
9+
10+
docker-push:
11+
docker push $(IMG):$(TAG)
12+
13+
.PHONY: docker-build-multi-arch
14+
docker-build-multi-arch: ## Build multi-arch docker images with docker buildx
15+
cd ../ && docker buildx build --load --platform ${ARCH} --tag ${IMG}:${TAG} -f ${DOCKERFILE} .
16+
17+
18+
.PHONY: docker-build-push-multi-arch
19+
docker-build-push-multi-arch: ## Build multi-arch docker images with docker buildx and push to docker registry
20+
cd ../ && docker buildx build --platform ${ARCH} --tag ${IMG}:${TAG} --push -f ${DOCKERFILE} .
21+
22+
image: docker-build docker-push

0 commit comments

Comments
 (0)