Initial build.
This commit is contained in:
39
.github/workflows/ghcr-push.yml
vendored
Normal file
39
.github/workflows/ghcr-push.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
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" ]
|
||||
paths:
|
||||
- '**/*.dockerfile'
|
||||
|
||||
jobs:
|
||||
build-0.6.13:
|
||||
name: Build + Publish 16
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
name: Checkout
|
||||
|
||||
- name: Set Environment
|
||||
run: |
|
||||
echo "SLUG=ghcr.io/cwpearson/cmake-format-0.6.13" >> $GITHUB_ENV
|
||||
echo "DATE=$(date +"%Y%m%d")" >> $GITHUB_ENV
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
docker build -f cmake-format-0.6.13.dockerfile -t "$SLUG:latest" -t "$SLUG:$DATE" .
|
||||
|
||||
- name: Publish to GHCR
|
||||
run: |
|
||||
echo '${{secrets.GHCR_TOKEN}}' | docker login ghcr.io -u cwpearson --password-stdin
|
||||
docker push "$SLUG:latest"
|
||||
docker push "$SLUG:$DATE"
|
22
README.md
22
README.md
@@ -1 +1,23 @@
|
||||
# cmake-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 cmake-format-0.6.13.dockerfile -t cmake-format-0.6.13:latest
|
||||
podman run --rm -v "${PWD}"/src cmake-format-0.6.13:latest cmake-format ...
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
1. Create a "personal access token (classic)" with `write:packages`
|
||||
* account > settings > developer settings > personal access tokens
|
||||
2. Put that personal access token as the repository secret `GHCR_TOKEN`.
|
||||
|
19
cmake-format-0.6.13.dockerfile
Normal file
19
cmake-format-0.6.13.dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
# Stage 1: Build environment
|
||||
FROM docker.io/redhat/ubi8 AS builder
|
||||
|
||||
LABEL maintainer="Carl Pearson <me@carlpearson.net>"
|
||||
LABEL org.opencontainers.image.title="cmake-format 0.6"
|
||||
LABEL description="A container with cmake-format 0.6"
|
||||
LABEL org.opencontainers.image.description="A container with cmake-format 0.6"
|
||||
LABEL org.opencontainers.image.source https://github.com/cwpearson/clang-format
|
||||
LABEL org.opencontainers.image.licenses="GPLv3"
|
||||
|
||||
RUN dnf install -y \
|
||||
python3 \
|
||||
&& dnf clean all
|
||||
|
||||
ADD pip-install.sh .
|
||||
RUN /bin/bash pip-install.sh
|
||||
|
||||
# expect caller to map $PWD into /src with -v flag
|
||||
WORKDIR /src
|
13
pip-install.sh
Normal file
13
pip-install.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
NEXUS_ROOT=https://nexus.web.sandia.gov/
|
||||
|
||||
if curl --output /dev/null --silent --head --fail "$NEXUS_ROOT"; then
|
||||
PIP_ARGS="--index-url=$NEXUS_ROOT/repository/pypi-proxy/simple"
|
||||
else
|
||||
PIP_ARGS=""
|
||||
fi
|
||||
|
||||
python3 -m pip install "$PIP_ARGS" cmakelang==0.6.13
|
Reference in New Issue
Block a user