Skip to content

Commit b435894

Browse files
author
Jon Lockwood
committed
Merge pull request 'feat: initial container' (#2) from feature-initial-container into development
Reviewed-on: https://nofusscomputing.com/git/docker/mkdocs-ci/pulls/2
2 parents d908093 + f4401a9 commit b435894

File tree

8 files changed

+467
-1
lines changed

8 files changed

+467
-1
lines changed

.github/workflows/docker.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
3+
name: 'Docker'
4+
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.sha }}
8+
cancel-in-progress: true
9+
10+
11+
on:
12+
push:
13+
branches:
14+
- '*'
15+
tags:
16+
- '*'
17+
18+
env:
19+
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2 # see https://github.com/nofusscomputing/action_python/issues/10
20+
DOCKER_BUILD_REGISTRY: ghcr.io
21+
DOCKER_BUILD_IMAGE_NAME: "nofusscomputing/mkdocs-ci"
22+
DOCKER_BUILD_IMAGE_TAG: ${{ github.sha }}
23+
DOCKER_PUBLISH_REGISTRY: "docker.io"
24+
DOCKER_PUBLISH_IMAGE_NAME: "nofusscomputing/mkdocs-ci"
25+
DOCKER_BUILD_USERNAME: ${{ github.actor }}
26+
DOCKER_BUILD_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
27+
DOCKER_PUBLISH_USERNAME: ${{ secrets.NFC_DOCKERHUB_USERNAME }}
28+
DOCKER_PUBLISH_PASSWORD: ${{ secrets.NFC_DOCKERHUB_TOKEN }}
29+
30+
DOCKER_FILE: dockerfile
31+
32+
jobs:
33+
34+
35+
docker-build:
36+
runs-on: ubuntu-latest
37+
name: Build Image
38+
steps:
39+
40+
41+
- uses: actions/checkout@v4
42+
43+
44+
- name: Log into GHCR Registry
45+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
46+
with:
47+
registry: ${{ env.DOCKER_BUILD_REGISTRY }}
48+
username: ${{ env.DOCKER_BUILD_USERNAME }}
49+
password: ${{ env.DOCKER_BUILD_PASSWORD }}
50+
51+
52+
- name: Set up QEMU
53+
uses: docker/setup-qemu-action@v3
54+
with:
55+
image: tonistiigi/binfmt:latest
56+
57+
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v3
60+
61+
62+
- name: Build and push
63+
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
64+
uses: docker/build-push-action@v6
65+
with:
66+
platforms: linux/amd64,linux/arm64
67+
push: true
68+
tags: ${{ env.DOCKER_BUILD_REGISTRY }}/${{ env.DOCKER_BUILD_IMAGE_NAME }}:${{ github.sha }}
69+
provenance: false
70+
sbom: false
71+
72+
73+
- name: Log into Publish Registry
74+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
75+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
76+
with:
77+
registry: ${{ env.DOCKER_PUBLISH_REGISTRY }}
78+
username: ${{ env.DOCKER_PUBLISH_USERNAME }}
79+
password: ${{ env.DOCKER_PUBLISH_PASSWORD }}
80+
81+
82+
- name: Build and push tagged
83+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
84+
uses: docker/build-push-action@v6
85+
with:
86+
platforms: linux/amd64,linux/arm64
87+
push: true
88+
tags: |
89+
${{ env.DOCKER_BUILD_REGISTRY }}/${{ env.DOCKER_BUILD_IMAGE_NAME }}:${{ github.sha }}
90+
${{ env.DOCKER_BUILD_REGISTRY }}/${{ env.DOCKER_BUILD_IMAGE_NAME }}:${{ github.ref_name }}
91+
${{ env.DOCKER_BUILD_REGISTRY }}/${{ env.DOCKER_BUILD_IMAGE_NAME }}:latest
92+
${{ env.DOCKER_PUBLISH_REGISTRY }}/${{ env.DOCKER_PUBLISH_IMAGE_NAME }}:${{ github.sha }}
93+
${{ env.DOCKER_PUBLISH_REGISTRY }}/${{ env.DOCKER_PUBLISH_IMAGE_NAME }}:${{ github.ref_name }}
94+
${{ env.DOCKER_PUBLISH_REGISTRY }}/${{ env.DOCKER_PUBLISH_IMAGE_NAME }}:latest
95+
provenance: false
96+
sbom: false
97+
98+
99+
docker-publish:
100+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
101+
runs-on: ubuntu-latest
102+
needs:
103+
- docker-build
104+
name: Publish
105+
steps:
106+
107+
108+
- name: Append GH Release Body
109+
id: release
110+
uses: softprops/action-gh-release@v2
111+
with:
112+
append_body: true
113+
draft: false
114+
body: |
115+
### Images part of this release
116+
117+
The following images were built and published:
118+
119+
- `docker pull ${{ env.DOCKER_PUBLISH_REGISTRY }}/${{ env.DOCKER_PUBLISH_IMAGE_NAME }}:${{ steps.tag-image.outputs.mutable_tag_name }}`
120+
- `docker pull ${{ env.DOCKER_PUBLISH_REGISTRY }}/${{ env.DOCKER_PUBLISH_IMAGE_NAME }}:${{ env.DOCKER_TAG_IMAGE_TAG_SOURCE }}`
121+
- `docker pull ${{ env.DOCKER_PUBLISH_REGISTRY }}/${{ env.DOCKER_PUBLISH_IMAGE_NAME }}:${{ github.ref_name }}`

.github/workflows/release.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
3+
name: 'Release'
4+
5+
6+
on:
7+
push:
8+
tags:
9+
- '*'
10+
11+
12+
env:
13+
# ACTIONS_RUNNER_DEBUG: "true"
14+
# ACTIONS_STEP_DEBUG: "true"
15+
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
16+
17+
18+
jobs:
19+
20+
21+
create:
22+
name: 'Create'
23+
if: startsWith(github.ref, 'refs/tags/')
24+
runs-on: ubuntu-latest
25+
steps:
26+
27+
28+
- name: Trace
29+
shell: bash
30+
run: |
31+
export
32+
33+
34+
- name: Install Commitizen
35+
shell: bash
36+
run: |
37+
pip install \
38+
commitizen==3.28.0
39+
40+
41+
- name: Checkout Code
42+
uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
fetch-tags: true
46+
token: ${{ secrets.WORKFLOW_TOKEN }}
47+
ref: ${{ github.ref_name }}
48+
49+
50+
- name: Create Incremental Changelog
51+
shell: bash
52+
run: |
53+
export PREV_GIT_TAG="$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)";
54+
export CURR_GIT_TAG="${{ github.ref_name }}";
55+
56+
cz changelog --dry-run --merge-prerelease --unreleased-version "$PREV_GIT_TAG" "$CURR_GIT_TAG" > changelog-release.md;
57+
58+
59+
- name: Create Draft GH Release
60+
uses: softprops/action-gh-release@v2
61+
with:
62+
name: ${{ github.ref_name }}
63+
tag_name: ${{ github.ref_name }}
64+
body_path: changelog-release.md
65+
make_latest: true
66+
prerelease: false
67+
draft: true

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "website-template"]
2+
path = website-template
3+
url = https://gitlab.com/nofusscomputing/infrastructure/website-template.git

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<br>
88

9-
![GitHub forks](https://img.shields.io/github/forks/NofussComputing/2Fdocker_mkdocs_ci?logo=github&style=plastic&color=000000&labell=Forks) ![GitHub stars](https://img.shields.io/github/stars/NofussComputing/2Fdocker_mkdocs_ci?color=000000&logo=github&style=plastic) ![Github Watchers](https://img.shields.io/github/watchers/NofussComputing/2Fdocker_mkdocs_ci?color=000000&label=Watchers&logo=github&style=plastic)
9+
![GitHub forks](https://img.shields.io/github/forks/NofussComputing/docker_mkdocs_ci?logo=github&style=plastic&color=000000&labell=Forks) ![GitHub stars](https://img.shields.io/github/stars/NofussComputing/docker_mkdocs_ci?color=000000&logo=github&style=plastic) ![Github Watchers](https://img.shields.io/github/watchers/NofussComputing/docker_mkdocs_ci?color=000000&label=Watchers&logo=github&style=plastic)
1010

1111
links:
1212

dockerfile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
ARG ALPINE_VERSION=3.23
3+
ARG PYTHON_VERSION=3.11
4+
5+
FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} AS build
6+
7+
8+
# RUN apk add --update \
9+
# git;
10+
# # gcc \
11+
# # cmake \
12+
# # libc-dev \
13+
# # alpine-sdk \
14+
# # libffi-dev \
15+
# # build-base;
16+
17+
18+
COPY requirements.txt /tmp/requirements.txt
19+
20+
COPY /website-template /website-template
21+
22+
23+
RUN mkdir -p /tmp/python_modules /tmp/python_builds
24+
25+
26+
RUN pip install --upgrade \
27+
setuptools \
28+
wheel \
29+
setuptools-rust \
30+
build \
31+
twine; \
32+
cd /tmp/python_modules; \
33+
cat /tmp/requirements.txt; \
34+
pip download --dest . --check-build-dependencies \
35+
-r /tmp/requirements.txt; \
36+
python -m build -w -o . /website-template/custom-plugins/*;
37+
38+
39+
RUN cd /tmp/python_modules; \
40+
ls -la /tmp/python_modules; \
41+
pip wheel --wheel-dir /tmp/python_builds --find-links . *.whl; \
42+
pip wheel --wheel-dir /tmp/python_builds --find-links . *.tar.gz || true; \
43+
ls -la /tmp/python_builds
44+
45+
46+
47+
FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}
48+
49+
50+
COPY --from=build /tmp/python_builds /tmp/python_builds
51+
52+
53+
COPY includes/ /
54+
55+
56+
RUN apk update --no-cache; \
57+
apk upgrade --no-cache; \
58+
apk add --no-cache \
59+
bash \
60+
envsubst \
61+
git \
62+
npm \
63+
yq; \
64+
pip install --no-cache-dir /tmp/python_builds/*.*; \
65+
rm -rf /tmp/python_builds; \
66+
chmod +x /entrypoint.sh; \
67+
npm install \
68+
markdownlint-cli2@v0.18.1 \
69+
markdownlint-cli2-formatter-junit \
70+
markdownlint-cli2-formatter-template \
71+
--global;
72+
73+
RUN git config --global --add safe.directory '*'
74+
75+
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)