Compare commits
13 Commits
verbose-do
...
master
Author | SHA1 | Date | |
---|---|---|---|
56e49fe154
|
|||
2886391c5b
|
|||
c02a37725c
|
|||
f3523a2cd3
|
|||
925b8d281d
|
|||
65341e4b84
|
|||
bbb718ab30
|
|||
5b5b9c4cc3
|
|||
2785dbcd3d
|
|||
549fcb94b6
|
|||
e10c7022fb
|
|||
04e4a5093c | |||
f035df06a1 |
@@ -2,9 +2,9 @@ name: Docker Image CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
branches: [ main ]
|
branches: [ master ]
|
||||||
push:
|
push:
|
||||||
branches: [ master, verbose-dockerfile-pipeline-test ]
|
branches: [ master ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
schedule:
|
schedule:
|
||||||
@@ -20,7 +20,12 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
images:
|
images:
|
||||||
[
|
[
|
||||||
openrc
|
base-devel,
|
||||||
|
base-openrc,
|
||||||
|
base-runit,
|
||||||
|
base-s6,
|
||||||
|
base-dinit,
|
||||||
|
base
|
||||||
]
|
]
|
||||||
env:
|
env:
|
||||||
REGISTRY: gitea.artixlinux.org
|
REGISTRY: gitea.artixlinux.org
|
||||||
@@ -38,12 +43,17 @@ jobs:
|
|||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
- name: Set up docker
|
- name: Set up docker
|
||||||
run: curl -fsSL https://get.docker.com | sh
|
run: curl -fsSL https://get.docker.com | sh
|
||||||
# - name: Define metadata variables
|
# - name: Set up Docker Buildx
|
||||||
# run: |
|
# id: buildx
|
||||||
# sed -i "s/ARG version=.*/ARG version=$(date +'%Y%m%d').0.${{ gitea.sha }}/" Dockerfile
|
# uses: docker/setup-buildx-action@v2
|
||||||
# sed -i "s/ARG githash=.*/ARG githash=${{ gitea.sha }}/" Dockerfile
|
# with:
|
||||||
# sed -i "s/ARG created=.*/ARG created=$(date -u +'%Y-%m-%dT%H:%M:%S%:z')/" Dockerfile
|
# install: true
|
||||||
# cat Dockerfile
|
- name: Define metadata variables
|
||||||
|
run: |
|
||||||
|
sed -i "s/ARG version=.*/ARG version=$(date +'%Y%m%d').0.${{ gitea.sha }}/" Dockerfile
|
||||||
|
sed -i "s/ARG githash=.*/ARG githash=${{ gitea.sha }}/" Dockerfile
|
||||||
|
sed -i "s/ARG created=.*/ARG created=$(date -u +'%Y-%m-%dT%H:%M:%S%:z')/" Dockerfile
|
||||||
|
cat Dockerfile
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
uses: https://github.com/docker/build-push-action@v5
|
uses: https://github.com/docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
@@ -52,18 +62,8 @@ jobs:
|
|||||||
no-cache: true
|
no-cache: true
|
||||||
context: .
|
context: .
|
||||||
build-args: |
|
build-args: |
|
||||||
img=${{ matrix.images }}
|
img=${{ matrix.images }}
|
||||||
tags: "${{ env.ABSOLUTE_IMAGE }}:base-${{ matrix.images }}-test,${{ env.ABSOLUTE_DH_IMAGE }}:${{ matrix.images }}-test"
|
tags: "${{ env.ABSOLUTE_IMAGE }}:${{ matrix.images }},${{ env.ABSOLUTE_DH_IMAGE }}:${{ matrix.images }},${{ env.ABSOLUTE_IMAGE }}:latest,${{ env.ABSOLUTE_DH_IMAGE }}:latest"
|
||||||
- name: Create latest tag
|
|
||||||
if: matrix.images == 'devel'
|
|
||||||
uses: https://github.com/docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
push: false
|
|
||||||
pull: false
|
|
||||||
context: .
|
|
||||||
build-args: |
|
|
||||||
img=${{ matrix.images }}
|
|
||||||
tags: "${{ env.ABSOLUTE_IMAGE }}:latest,${{ env.ABSOLUTE_DH_IMAGE }}:latest"
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: https://github.com/docker/login-action@v2
|
uses: https://github.com/docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
@@ -71,10 +71,10 @@ jobs:
|
|||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.PAT }}
|
password: ${{ secrets.PAT }}
|
||||||
- name: Push to Gitea
|
- name: Push to Gitea
|
||||||
if: ( gitea.event_name == 'push' && github.ref == 'refs/heads/master' ) || gitea.event_name == 'schedule'
|
if: github.ref == 'refs/heads/master' && ( gitea.event_name == 'push' || gitea.event_name == 'schedule' )
|
||||||
run: docker push "${{ env.ABSOLUTE_IMAGE }}:base-${{ matrix.images }}-test"
|
run: docker push "${{ env.ABSOLUTE_IMAGE }}:${{ matrix.images }}"
|
||||||
- name: Push latest tag
|
- name: Push latest tag
|
||||||
if: ( ( gitea.event_name == 'push' && github.ref == 'refs/heads/master' ) || gitea.event_name == 'schedule' ) && matrix.images == 'devel'
|
if: ( github.ref == 'refs/heads/master' && ( gitea.event_name == 'push' || gitea.event_name == 'schedule' ) ) && matrix.images == 'base'
|
||||||
run: docker push "${{ env.ABSOLUTE_IMAGE }}:latest"
|
run: docker push "${{ env.ABSOLUTE_IMAGE }}:latest"
|
||||||
- name: Log in to the Docker Hub
|
- name: Log in to the Docker Hub
|
||||||
uses: https://github.com/docker/login-action@v2
|
uses: https://github.com/docker/login-action@v2
|
||||||
@@ -83,8 +83,8 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USER }}
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
password: ${{ secrets.DOCKERHUB }}
|
password: ${{ secrets.DOCKERHUB }}
|
||||||
- name: Push to Docker Hub
|
- name: Push to Docker Hub
|
||||||
if: ( gitea.event_name == 'push' && github.ref == 'refs/heads/master' ) || gitea.event_name == 'schedule'
|
if: github.ref == 'refs/heads/master' && ( gitea.event_name == 'push' || gitea.event_name == 'schedule' )
|
||||||
run: docker push "${{ env.ABSOLUTE_DH_IMAGE }}:${{ matrix.images }}-test"
|
run: docker push "${{ env.ABSOLUTE_DH_IMAGE }}:${{ matrix.images }}"
|
||||||
- name: Push latest tag
|
- name: Push latest tag
|
||||||
if: ( ( gitea.event_name == 'push' && github.ref == 'refs/heads/master' ) || gitea.event_name == 'schedule' ) && matrix.images == 'devel'
|
if: ( github.ref == 'refs/heads/master' && ( gitea.event_name == 'push' || gitea.event_name == 'schedule' ) ) && matrix.images == 'base'
|
||||||
run: docker push "${{ env.ABSOLUTE_DH_IMAGE }}:latest"
|
run: docker push "${{ env.ABSOLUTE_DH_IMAGE }}:latest"
|
32
Dockerfile
32
Dockerfile
@@ -1,33 +1,13 @@
|
|||||||
FROM gitea.artixlinux.org/artixdocker/artixlinux:latest as base
|
FROM artixlinux/artixlinux:latest AS build
|
||||||
|
|
||||||
|
WORKDIR /usr/artixlinux-docker
|
||||||
RUN pacman -Syu --noconfirm && \
|
RUN pacman -Syu --noconfirm && \
|
||||||
pacman -Sy --noconfirm artools curl make fakechroot fakeroot
|
pacman -Sy --noconfirm artools curl make fakechroot fakeroot
|
||||||
WORKDIR /usr/artixlinux-docker
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
FROM base as build
|
|
||||||
ARG img=base-devel
|
ARG img=base-devel
|
||||||
ENV working=/usr/artixlinux-docker
|
COPY . .
|
||||||
ENV BUILDDIR=${working}/build
|
RUN make "dockerfile-${img}"
|
||||||
ENV OUTPUTDIR=${working}/output
|
WORKDIR /usr/artixlinux-docker/output
|
||||||
WORKDIR ${working}
|
COPY . .
|
||||||
RUN mkdir -vp ${BUILDDIR}/alpm-hooks/usr/share/libalpm/hooks && \
|
|
||||||
find /usr/share/libalpm/hooks -exec ln -sf /dev/null ${BUILDDIR}/alpm-hooks{} \; && \
|
|
||||||
mkdir -vp ${BUILDDIR}/var/lib/pacman/ ${OUTPUTDIR} && \
|
|
||||||
install -Dm644 /usr/share/artools/pacman.conf.d/galaxy-x86_64.conf ${BUILDDIR}/etc/pacman.conf && \
|
|
||||||
cat pacman-conf.d-noextract.conf >> ${BUILDDIR}/etc/pacman.conf && \
|
|
||||||
fakechroot fakeroot pacman -Sy -r ${BUILDDIR} --noconfirm --dbpath ${BUILDDIR}/var/lib/pacman --config ${BUILDDIR}/etc/pacman.conf --noscriptlet --hookdir ${BUILDDIR}/alpm-hooks/usr/share/libalpm/hooks/ ${img} && \
|
|
||||||
rsync -rt --backup --suffix=.pacnew rootfs/* ${BUILDDIR}/ && \
|
|
||||||
fakechroot fakeroot chroot ${BUILDDIR} update-ca-trust && \
|
|
||||||
fakechroot fakeroot chroot ${BUILDDIR} sh -c 'pacman-key --init && pacman-key --populate && rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*' && \
|
|
||||||
ln -fs /usr/lib/os-release ${BUILDDIR}/etc/os-release && \
|
|
||||||
sed -i -e 's/^root::/root:!:/' "${BUILDDIR}/etc/shadow" && \
|
|
||||||
fakeroot tar --numeric-owner --xattrs --acls --exclude-from=exclude -C ${BUILDDIR} -c . -f ${OUTPUTDIR}/${img}.tar
|
|
||||||
WORKDIR ${OUTPUTDIR}
|
|
||||||
RUN zstd --long -T0 -8 ${img}.tar; sha256sum ${img}.tar.zst > ${img}.tar.zst.SHA256
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR ${OUTPUTDIR}
|
|
||||||
RUN ROOTFS=${img}.tar.zst && \
|
RUN ROOTFS=${img}.tar.zst && \
|
||||||
sha256sum -c ${img}.tar.zst.SHA256 && \
|
sha256sum -c ${img}.tar.zst.SHA256 && \
|
||||||
mkdir /rootfs && \
|
mkdir /rootfs && \
|
||||||
|
15
Makefile
15
Makefile
@@ -25,6 +25,8 @@ define rootfs
|
|||||||
|
|
||||||
fakechroot fakeroot chroot $(BUILDDIR) sh -c 'pacman-key --init && pacman-key --populate && rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*'
|
fakechroot fakeroot chroot $(BUILDDIR) sh -c 'pacman-key --init && pacman-key --populate && rm -rf etc/pacman.d/gnupg/{openpgp-revocs.d/,private-keys-v1.d/,pubring.gpg~,gnupg.S.}*'
|
||||||
|
|
||||||
|
fakechroot fakeroot chroot $(BUILDDIR) /usr/bin/esysusers --root "/"
|
||||||
|
|
||||||
ln -fs /usr/lib/os-release $(BUILDDIR)/etc/os-release
|
ln -fs /usr/lib/os-release $(BUILDDIR)/etc/os-release
|
||||||
|
|
||||||
# add system users
|
# add system users
|
||||||
@@ -53,6 +55,9 @@ endef
|
|||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILDDIR) $(OUTPUTDIR)
|
rm -rf $(BUILDDIR) $(OUTPUTDIR)
|
||||||
|
|
||||||
|
$(OUTPUTDIR)/base.tar.zst:
|
||||||
|
$(call rootfs,base,base)
|
||||||
|
|
||||||
$(OUTPUTDIR)/base-openrc.tar.zst:
|
$(OUTPUTDIR)/base-openrc.tar.zst:
|
||||||
$(call rootfs,base-openrc,base,elogind-openrc)
|
$(call rootfs,base-openrc,base,elogind-openrc)
|
||||||
|
|
||||||
@@ -65,6 +70,9 @@ $(OUTPUTDIR)/base-s6.tar.zst:
|
|||||||
$(OUTPUTDIR)/base-dinit.tar.zst:
|
$(OUTPUTDIR)/base-dinit.tar.zst:
|
||||||
$(call rootfs,base-dinit,base,elogind-dinit)
|
$(call rootfs,base-dinit,base,elogind-dinit)
|
||||||
|
|
||||||
|
$(OUTPUTDIR)/Dockerfile.base: $(OUTPUTDIR)/base.tar.zst
|
||||||
|
$(call dockerfile,base)
|
||||||
|
|
||||||
$(OUTPUTDIR)/Dockerfile.base-openrc: $(OUTPUTDIR)/base-openrc.tar.zst
|
$(OUTPUTDIR)/Dockerfile.base-openrc: $(OUTPUTDIR)/base-openrc.tar.zst
|
||||||
$(call dockerfile,base-openrc)
|
$(call dockerfile,base-openrc)
|
||||||
|
|
||||||
@@ -95,6 +103,9 @@ dockerfile-base-s6: $(OUTPUTDIR)/Dockerfile.base-s6
|
|||||||
.PHONY: docker-file-base-dinit
|
.PHONY: docker-file-base-dinit
|
||||||
dockerfile-base-dinit: $(OUTPUTDIR)/Dockerfile.base-dinit
|
dockerfile-base-dinit: $(OUTPUTDIR)/Dockerfile.base-dinit
|
||||||
|
|
||||||
|
.PHONY: docker-file-base
|
||||||
|
dockerfile-base: $(OUTPUTDIR)/Dockerfile.base
|
||||||
|
|
||||||
.PHONY: docker-file-base-devel
|
.PHONY: docker-file-base-devel
|
||||||
dockerfile-base-devel: $(OUTPUTDIR)/Dockerfile.base-devel
|
dockerfile-base-devel: $(OUTPUTDIR)/Dockerfile.base-devel
|
||||||
|
|
||||||
@@ -114,6 +125,10 @@ image-base-s6: $(OUTPUTDIR)/Dockerfile.base-s6
|
|||||||
image-base-dinit: $(OUTPUTDIR)/Dockerfile.base-dinit
|
image-base-dinit: $(OUTPUTDIR)/Dockerfile.base-dinit
|
||||||
${DOCKER} build -f $(OUTPUTDIR)/Dockerfile.base-dinit -t $(REGISTRY)/$(OWNER)/artixlinux:base-dinit $(OUTPUTDIR)
|
${DOCKER} build -f $(OUTPUTDIR)/Dockerfile.base-dinit -t $(REGISTRY)/$(OWNER)/artixlinux:base-dinit $(OUTPUTDIR)
|
||||||
|
|
||||||
|
.PHONY: docker-image-base
|
||||||
|
image-base: $(OUTPUTDIR)/Dockerfile.base
|
||||||
|
${DOCKER} build -f $(OUTPUTDIR)/Dockerfile.base -t $(REGISTRY)/$(OWNER)/artixlinux:base $(OUTPUTDIR)
|
||||||
|
|
||||||
.PHONY: docker-image-base-devel
|
.PHONY: docker-image-base-devel
|
||||||
image-base-devel: $(OUTPUTDIR)/Dockerfile.base-devel
|
image-base-devel: $(OUTPUTDIR)/Dockerfile.base-devel
|
||||||
${DOCKER} build -f $(OUTPUTDIR)/Dockerfile.base-devel -t $(REGISTRY)/$(OWNER)/artixlinux:base-devel $(OUTPUTDIR)
|
${DOCKER} build -f $(OUTPUTDIR)/Dockerfile.base-devel -t $(REGISTRY)/$(OWNER)/artixlinux:base-devel $(OUTPUTDIR)
|
||||||
|
@@ -10,11 +10,12 @@
|
|||||||
|
|
||||||
# Supported tags
|
# Supported tags
|
||||||
|
|
||||||
* latest, devel
|
* latest, base
|
||||||
* dinit
|
* base-devel
|
||||||
* openrc
|
* base-dinit
|
||||||
* runit
|
* base-openrc
|
||||||
* s6
|
* base-runit
|
||||||
|
* base-s6
|
||||||
|
|
||||||
## Dockerfile repo
|
## Dockerfile repo
|
||||||
|
|
||||||
@@ -31,8 +32,8 @@
|
|||||||
# How to run
|
# How to run
|
||||||
|
|
||||||
```
|
```
|
||||||
docker pull artixlinux/artixlinux:devel
|
docker pull artixlinux/artixlinux:base
|
||||||
docker run -it --rm artixlinux/artixlinux:devel /bin/bash
|
docker run -it --rm artixlinux/artixlinux:base /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that `--rm` removes the container on exit.
|
Note that `--rm` removes the container on exit.
|
Reference in New Issue
Block a user