Compare commits

...

10 Commits

Author SHA1 Message Date
Carl Pearson
99ff63c431 Dockerfiles: update source labels 2025-03-30 19:57:47 -06:00
Carl Pearson
1c53bd298d remove github actions 2025-03-30 19:57:47 -06:00
Carl Pearson
5c716395be builds.sr.ht ci 2025-03-30 19:57:45 -06:00
Carl Pearson
ad44e13463 README: fix volume mount typo 2024-10-29 11:09:09 -06:00
Carl Pearson
17196fd76f add clang-format-14 2024-07-10 12:56:43 -06:00
Carl Pearson
df1e69079f Move labels to final image 2024-07-10 11:06:07 -06:00
Carl Pearson
f16908a3d8 MIT license label on images 2024-07-10 08:46:03 -06:00
Carl Pearson
6574834b83 MIT license on repository 2024-07-10 08:45:57 -06:00
Carl Pearson
27ebd20334 Update README, only run builds when dockerfiles touched 2024-07-10 08:45:57 -06:00
Carl Pearson
2351edc411 ci: build latest and date tags 2024-07-10 08:45:45 -06:00
10 changed files with 217 additions and 76 deletions

33
.builds/14.yaml Normal file
View File

@@ -0,0 +1,33 @@
image: debian/bookworm
secrets:
- a19cbc4c-b6a1-414e-bf1c-1e06abc684eb
tasks:
- print-env: |
echo "$JOB_ID"
echo "$JOB_URL"
echo "$BUILD_SUBMITTER"
echo "$BUILD_REASON"
echo "$GIT_REF"
- setup-env: |
sudo timedatectl set-timezone America/Denver
echo "SLUG=ghcr.io/cwpearson/clang-format-14" >> ~/.buildenv
echo "DATE=$(date +"%Y%m%d_%H%M")" >> ~/.buildenv
- prerequisites: |
bash clang-format/.ci/debian_setup_docker.sh
- build: |
cd clang-format
docker build . --file clang-format-14.dockerfile --tag "$SLUG:$DATE" --tag "$SLUG:latest"
- deploy: |
if [ "$GIT_REF" != "refs/heads/master" ]; then exit 0; fi
set +x
cat ~/.ghcr_token | docker login ghcr.io -u cwpearson --password-stdin
set -x
docker push "$SLUG:latest"
docker push "$SLUG:$DATE"
triggers:
- action: email
condition: failure
to: Carl Pearson <srht@carlpearson.net>

33
.builds/16.yaml Normal file
View File

@@ -0,0 +1,33 @@
image: debian/bookworm
secrets:
- a19cbc4c-b6a1-414e-bf1c-1e06abc684eb
tasks:
- print-env: |
echo "$JOB_ID"
echo "$JOB_URL"
echo "$BUILD_SUBMITTER"
echo "$BUILD_REASON"
echo "$GIT_REF"
- setup-env: |
sudo timedatectl set-timezone America/Denver
echo "SLUG=ghcr.io/cwpearson/clang-format-16" >> ~/.buildenv
echo "DATE=$(date +"%Y%m%d_%H%M")" >> ~/.buildenv
- prerequisites: |
bash clang-format/.ci/debian_setup_docker.sh
- build: |
cd clang-format
docker build . --file clang-format-16.dockerfile --tag "$SLUG:$DATE" --tag "$SLUG:latest"
- deploy: |
if [ "$GIT_REF" != "refs/heads/master" ]; then exit 0; fi
set +x
cat ~/.ghcr_token | docker login ghcr.io -u cwpearson --password-stdin
set -x
docker push "$SLUG:latest"
docker push "$SLUG:$DATE"
triggers:
- action: email
condition: failure
to: Carl Pearson <srht@carlpearson.net>

33
.builds/8.yaml Normal file
View File

@@ -0,0 +1,33 @@
image: debian/bookworm
secrets:
- a19cbc4c-b6a1-414e-bf1c-1e06abc684eb
tasks:
- print-env: |
echo "$JOB_ID"
echo "$JOB_URL"
echo "$BUILD_SUBMITTER"
echo "$BUILD_REASON"
echo "$GIT_REF"
- setup-env: |
sudo timedatectl set-timezone America/Denver
echo "SLUG=ghcr.io/cwpearson/clang-format-8" >> ~/.buildenv
echo "DATE=$(date +"%Y%m%d_%H%M")" >> ~/.buildenv
- prerequisites: |
bash clang-format/.ci/debian_setup_docker.sh
- build: |
cd clang-format
docker build . --file clang-format-8.dockerfile --tag "$SLUG:$DATE" --tag "$SLUG:latest"
- deploy: |
if [ "$GIT_REF" != "refs/heads/master" ]; then exit 0; fi
set +x
cat ~/.ghcr_token | docker login ghcr.io -u cwpearson --password-stdin
set -x
docker push "$SLUG:latest"
docker push "$SLUG:$DATE"
triggers:
- action: email
condition: failure
to: Carl Pearson <srht@carlpearson.net>

View File

@@ -0,0 +1,17 @@
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $(whoami)

View File

@@ -1,50 +0,0 @@
name: Deploy to GHCR
# only run most recent workflow in branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [ "master" ]
jobs:
build-16:
name: Build + Publish 16
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Build
run: |
docker build -f clang-format-16.dockerfile -t ghcr.io/cwpearson/clang-format-16:latest .
- name: Publish to GHCR
run: |
echo '${{secrets.GHCR_TOKEN}}' | docker login ghcr.io -u cwpearson --password-stdin
docker push ghcr.io/cwpearson/clang-format-16:latest
build-8:
name: Build + Publish 8
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Build
run: |
docker build -f clang-format-8.dockerfile -t ghcr.io/cwpearson/clang-format-8:latest .
- name: Publish to GHCR
run: |
echo '${{secrets.GHCR_TOKEN}}' | docker login ghcr.io -u cwpearson --password-stdin
docker push ghcr.io/cwpearson/clang-format-8:latest

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Carl Pearson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,4 +1,15 @@
#
# clang-format
## Quick Run
```bash
cd your/source/tree
podman run --rm -v "${PWD}":/src ghcr.io/cwpearson/clang-format-16:latest clang-format ...
```
Inside the container, the working directory is /src, we use the volume mount to map the host working directory `${PWD}` into `/src`: `-v "${PWD}"/src`.
## Building the Image Locally
```bash
podman build -f clang-format-16.dockerfile -t clang-format-16:latest

View File

@@ -0,0 +1,44 @@
# Stage 1: Build environment
FROM docker.io/redhat/ubi8 AS builder
RUN dnf install -y \
cmake \
gcc \
gcc-c++ \
python3 \
wget \
xz \
&& dnf clean all
RUN wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/llvm-project-14.0.6.src.tar.xz \
&& tar -xf llvm-project-14.0.6.src.tar.xz
RUN cmake -S llvm-project-14.0.6.src/llvm -B build \
-DLLVM_ENABLE_PROJECTS='clang' \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DLLVM_TARGETS_TO_BUILD=""
RUN make -C build -j$(nproc) install
# base final image off ubi8-micro
FROM docker.io/redhat/ubi8-micro
LABEL maintainer="Carl Pearson <me@carlpearson.net>"
LABEL org.opencontainers.image.title="clang-format 14"
LABEL description="A container with clang-format 14"
LABEL org.opencontainers.image.description="A container with clang-format 14"
LABEL org.opencontainers.image.source https://git.sr.ht/~cwpearson/clang-format
LABEL org.opencontainers.image.licenses="MIT"
# LABEL version="1.0"
# LABEL org.opencontainers.image.version="1.0"
# LABEL org.opencontainers.image.url="https://example.com"
# LABEL org.opencontainers.image.documentation="https://example.com/docs"
# LABEL org.opencontainers.image.vendor="Example Corp"
# clang-format-14 links this
COPY --from=builder /lib64/libstdc++.so.6 /lib64/libstdc++.so.6
# keep clang-format binary only
COPY --from=builder /usr/local/bin/clang-format /usr/local/bin/clang-format
# also provide clang-format-14
RUN ln -s /usr/local/bin/clang-format /usr/local/bin/clang-format-14
# expect caller to map $PWD into /src with -v flag
WORKDIR /src

View File

@@ -1,19 +1,6 @@
# Stage 1: Build environment
FROM docker.io/redhat/ubi8 AS builder
LABEL maintainer="Carl Pearson <me@carlpearson.net>"
LABEL org.opencontainers.image.title="clang-format 16"
LABEL description="A container with clang-format 16"
LABEL org.opencontainers.image.description="A container with clang-format 16"
LABEL org.opencontainers.image.source https://github.com/cwpearson/clang-format
# LABEL version="1.0"
# LABEL org.opencontainers.image.version="1.0"
# LABEL org.opencontainers.image.url="https://example.com"
# LABEL org.opencontainers.image.documentation="https://example.com/docs"
# LABEL org.opencontainers.image.vendor="Example Corp"
# LABEL org.opencontainers.image.licenses="MIT"
RUN dnf install -y \
cmake \
gcc \
@@ -34,6 +21,18 @@ RUN make -C build -j$(nproc) install
# base final image off ubi8-micro
FROM docker.io/redhat/ubi8-micro
LABEL maintainer="Carl Pearson <me@carlpearson.net>"
LABEL org.opencontainers.image.title="clang-format 16"
LABEL description="A container with clang-format 16"
LABEL org.opencontainers.image.description="A container with clang-format 16"
LABEL org.opencontainers.image.source https://git.sr.ht/~cwpearson/clang-format
LABEL org.opencontainers.image.licenses="MIT"
# LABEL version="1.0"
# LABEL org.opencontainers.image.version="1.0"
# LABEL org.opencontainers.image.url="https://example.com"
# LABEL org.opencontainers.image.documentation="https://example.com/docs"
# LABEL org.opencontainers.image.vendor="Example Corp"
# clang-format-16 links this
COPY --from=builder /lib64/libstdc++.so.6 /lib64/libstdc++.so.6
# keep clang-format binary only

View File

@@ -1,18 +1,6 @@
# Stage 1: Build environment
FROM docker.io/redhat/ubi8 AS builder
LABEL maintainer="Carl Pearson <me@carlpearson.net>"
LABEL org.opencontainers.image.title="clang-format 8"
LABEL description="A container with clang-format 8"
LABEL org.opencontainers.image.description="A container with clang-format 8"
LABEL org.opencontainers.image.source https://github.com/cwpearson/clang-format
# LABEL version="1.0"
# LABEL org.opencontainers.image.version="1.0"
# LABEL org.opencontainers.image.url="https://example.com"
# LABEL org.opencontainers.image.documentation="https://example.com/docs"
# LABEL org.opencontainers.image.vendor="Example Corp"
# LABEL org.opencontainers.image.licenses="MIT"
RUN dnf install -y \
cmake \
gcc \
@@ -36,6 +24,18 @@ RUN make -C build -j$(nproc) install
# base final image off ubi8-micro
FROM docker.io/redhat/ubi8-micro
LABEL maintainer="Carl Pearson <me@carlpearson.net>"
LABEL org.opencontainers.image.title="clang-format 8"
LABEL description="A container with clang-format 8"
LABEL org.opencontainers.image.description="A container with clang-format 8"
LABEL org.opencontainers.image.source https://git.sr.ht/~cwpearson/clang-format
LABEL org.opencontainers.image.licenses="MIT"
# LABEL version="1.0"
# LABEL org.opencontainers.image.version="1.0"
# LABEL org.opencontainers.image.url="https://example.com"
# LABEL org.opencontainers.image.documentation="https://example.com/docs"
# LABEL org.opencontainers.image.vendor="Example Corp"
# clang-format-16 links this
COPY --from=builder /lib64/libstdc++.so.6 /lib64/libstdc++.so.6
# keep clang-format binary only