Skip to content

Commit 8584aa5

Browse files
committed
Grab bag of updates
- Unique metadata for each image - Security notice in shell welcome message - Added gcc-multilib - Fixed reportgenerator installation shell conditional
1 parent eabe1b0 commit 8584aa5

File tree

18 files changed

+163
-75
lines changed

18 files changed

+163
-75
lines changed

.github/workflows/dev.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ on:
1010
- 'main'
1111

1212
env:
13-
IMAGE_BASE_NAME: 'throwtheswitch/madsciencelab'
13+
IMAGE_ORG: 'throwtheswitch'
14+
IMAGE_BASE_NAME: 'madsciencelab'
1415

1516

1617
jobs:
@@ -24,6 +25,10 @@ jobs:
2425
packages: write
2526
attestations: write
2627
id-token: write
28+
env:
29+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}"
30+
# Cannot reference IMAGE_NAME as it does not exist yet
31+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-plugins"
2732

2833
steps:
2934
- name: 'Checkout GitHub Action'
@@ -49,8 +54,10 @@ jobs:
4954
with:
5055
platforms: linux/amd64,linux/arm64
5156
file: build/standard/docker/Dockerfile
52-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
53-
tags: ${{ env.IMAGE_BASE_NAME }}:latest
57+
build-args: |
58+
CONTAINER_VERSION=${{ github.ref_name }}
59+
IMAGE_NAME=${{ env.IMAGE_NAME }}
60+
tags: ${{ env.IMAGE_URL }}:latest
5461

5562
madsciencelab-plugins:
5663
runs-on: ubuntu-latest
@@ -59,8 +66,12 @@ jobs:
5966
packages: write
6067
attestations: write
6168
id-token: write
62-
env:
63-
VARIANT: plugins
69+
env:
70+
VARIANT: 'plugins'
71+
# Cannot reference VARIANT as it does not exist yet
72+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}-plugins"
73+
# Cannot reference IMAGE_NAME as it does not exist yet
74+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-plugins"
6475

6576
steps:
6677
- name: 'Checkout GitHub Action'
@@ -80,13 +91,15 @@ jobs:
8091
password: ${{ secrets.DOCKERHUB_TOKEN }}
8192

8293
# Docker image: madsciencelab-plugins
83-
- name: 'Build Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}'
94+
- name: 'Build Docker image ${{ env.IMAGE_NAME }}'
8495
uses: docker/build-push-action@v6
8596
with:
8697
platforms: linux/amd64,linux/arm64
8798
file: build/${{ env.VARIANT }}/docker/Dockerfile
88-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
89-
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
99+
build-args: |
100+
CONTAINER_VERSION=${{ github.ref_name }}
101+
IMAGE_NAME=${{ env.IMAGE_NAME }}
102+
tags: ${{ env.IMAGE_URL }}:latest
90103

91104
madsciencelab-arm-none-eabi:
92105
runs-on: ubuntu-latest
@@ -96,7 +109,11 @@ jobs:
96109
attestations: write
97110
id-token: write
98111
env:
99-
VARIANT: arm-none-eabi
112+
VARIANT: 'arm-none-eabi'
113+
# Cannot reference VARIANT as it does not exist yet
114+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}-arm-none-eabi"
115+
# Cannot reference IMAGE_NAME as it does not exist yet
116+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-arm-none-eabi"
100117

101118
steps:
102119
- name: 'Checkout GitHub Action'
@@ -121,8 +138,10 @@ jobs:
121138
with:
122139
platforms: linux/amd64,linux/arm64
123140
file: build/${{ env.VARIANT }}/docker/Dockerfile
124-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
125-
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
141+
build-args: |
142+
CONTAINER_VERSION=${{ github.ref_name }}
143+
IMAGE_NAME=${{ env.IMAGE_NAME }}
144+
tags: ${{ env.IMAGE_URL }}:latest
126145

127146
madsciencelab-arm-none-eabi-plugins:
128147
runs-on: ubuntu-latest
@@ -132,7 +151,11 @@ jobs:
132151
attestations: write
133152
id-token: write
134153
env:
135-
VARIANT: arm-none-eabi-plugins
154+
VARIANT: 'arm-none-eabi-plugins'
155+
# Cannot reference VARIANT as it does not exist yet
156+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins"
157+
# Cannot reference IMAGE_NAME as it does not exist yet
158+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins"
136159

137160
steps:
138161
- name: 'Checkout GitHub Action'
@@ -157,6 +180,8 @@ jobs:
157180
with:
158181
platforms: linux/amd64,linux/arm64
159182
file: build/${{ env.VARIANT }}/docker/Dockerfile
160-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
161-
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
183+
build-args: |
184+
CONTAINER_VERSION=${{ github.ref_name }}
185+
IMAGE_NAME=${{ env.IMAGE_NAME }}
186+
tags: ${{ env.IMAGE_URL }}:latest
162187

.github/workflows/release.yml

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
- '*'
88

99
env:
10-
IMAGE_BASE_NAME: 'throwtheswitch/madsciencelab'
10+
IMAGE_ORG: 'throwtheswitch'
11+
IMAGE_BASE_NAME: 'madsciencelab'
1112

1213

1314
jobs:
@@ -21,6 +22,10 @@ jobs:
2122
packages: write
2223
attestations: write
2324
id-token: write
25+
env:
26+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}"
27+
# Cannot reference IMAGE_NAME as it does not exist yet
28+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-plugins"
2429

2530
steps:
2631
- name: 'Checkout GitHub Action'
@@ -46,9 +51,11 @@ jobs:
4651
with:
4752
platforms: linux/amd64,linux/arm64
4853
file: build/standard/docker/Dockerfile
49-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
54+
build-args: |
55+
CONTAINER_VERSION=${{ github.ref_name }}
56+
IMAGE_NAME=${{ env.IMAGE_NAME }}
5057
push: ${{ github.event_name != 'pull_request' }}
51-
tags: ${{ env.IMAGE_BASE_NAME }}:${{ github.ref_name }}, ${{ env.IMAGE_BASE_NAME }}:latest
58+
tags: ${{ env.IMAGE_URL }}:${{ github.ref_name }}, ${{ env.IMAGE_URL }}:latest
5259

5360
madsciencelab-plugins:
5461
runs-on: ubuntu-latest
@@ -58,7 +65,11 @@ jobs:
5865
attestations: write
5966
id-token: write
6067
env:
61-
VARIANT: plugins
68+
VARIANT: 'plugins'
69+
# Cannot reference VARIANT as it does not exist yet
70+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}-plugins"
71+
# Cannot reference IMAGE_NAME as it does not exist yet
72+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-plugins"
6273

6374
steps:
6475
- name: 'Checkout GitHub Action'
@@ -83,9 +94,11 @@ jobs:
8394
with:
8495
platforms: linux/amd64,linux/arm64
8596
file: build/${{ env.VARIANT }}/docker/Dockerfile
86-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
97+
build-args: |
98+
CONTAINER_VERSION=${{ github.ref_name }}
99+
IMAGE_NAME=${{ env.IMAGE_NAME }}
87100
push: ${{ github.event_name != 'pull_request' }}
88-
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}, ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
101+
tags: ${{ env.IMAGE_URL }}:${{ github.ref_name }}, ${{ env.IMAGE_URL }}:latest
89102

90103
madsciencelab-arm-none-eabi:
91104
runs-on: ubuntu-latest
@@ -95,7 +108,11 @@ jobs:
95108
attestations: write
96109
id-token: write
97110
env:
98-
VARIANT: arm-none-eabi
111+
VARIANT: 'arm-none-eabi'
112+
# Cannot reference VARIANT as it does not exist yet
113+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}-arm-none-eabi"
114+
# Cannot reference IMAGE_NAME as it does not exist yet
115+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-arm-none-eabi"
99116

100117
steps:
101118
- name: 'Checkout GitHub Action'
@@ -120,9 +137,11 @@ jobs:
120137
with:
121138
platforms: linux/amd64,linux/arm64
122139
file: build/${{ env.VARIANT }}/docker/Dockerfile
123-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
140+
build-args: |
141+
CONTAINER_VERSION=${{ github.ref_name }}
142+
IMAGE_NAME=${{ env.IMAGE_NAME }}
124143
push: ${{ github.event_name != 'pull_request' }}
125-
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}, ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
144+
tags: ${{ env.IMAGE_URL }}:${{ github.ref_name }}, ${{ env.IMAGE_URL }}:latest
126145

127146
madsciencelab-arm-none-eabi-plugins:
128147
runs-on: ubuntu-latest
@@ -132,7 +151,11 @@ jobs:
132151
attestations: write
133152
id-token: write
134153
env:
135-
VARIANT: arm-none-eabi-plugins
154+
VARIANT: 'arm-none-eabi-plugins'
155+
# Cannot reference VARIANT as it does not exist yet
156+
IMAGE_NAME: "${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins"
157+
# Cannot reference IMAGE_NAME as it does not exist yet
158+
IMAGE_URL: "${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins"
136159

137160
steps:
138161
- name: 'Checkout GitHub Action'
@@ -157,7 +180,9 @@ jobs:
157180
with:
158181
platforms: linux/amd64,linux/arm64
159182
file: build/${{ env.VARIANT }}/docker/Dockerfile
160-
build-args: CONTAINER_VERSION=${{ github.ref_name }}
183+
build-args: |
184+
CONTAINER_VERSION=${{ github.ref_name }}
185+
IMAGE_NAME=${{ env.IMAGE_NAME }}
161186
push: ${{ github.event_name != 'pull_request' }}
162-
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}, ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest
187+
tags: ${{ env.IMAGE_URL }}:${{ github.ref_name }}, ${{ env.IMAGE_URL }}:latest
163188

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ image is to create an easy-to-install portable system for running unit tests wit
2222

2323
### Generating Dockerfiles
2424

25-
`./build.sh --dir build/standard --variant "" --version 1.0.0-prerelease`
25+
`./build.sh --dir build/standard --variant "" --version 1.0.0`
2626

27-
`./build.sh --dir build/standard --dir build/plugins --version 1.0.0-prerelease`
27+
`./build.sh --dir build/standard --dir build/plugins --version 1.0.0`
2828

29-
`./build.sh --dir build/arm-none-eabi --version 1.0.0-prerelease`
29+
`./build.sh --dir build/arm-none-eabi --version 1.0.0`
3030

31-
`./build.sh --dir build/arm-none-eabi --dir build/plugins --dir build/arm-none-eabi-plugins --version 1.0.0-prerelease`
31+
`./build.sh --dir build/arm-none-eabi --dir build/plugins --dir build/arm-none-eabi-plugins --version 1.0.0`
3232

3333

3434
## Basic Articles Discussing Unit Testing

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ if [ "$BUILD" = true ]; then
298298

299299
# Perform multi-platform build with output as an image or optionally a direct push to the repository
300300
# Always echo this command to the command line
301-
(set -x; docker $BUILD_ACTION $LOG_ARGS -t "$IMAGE":"$IMAGE_TAG" $PLATFORM_ARGS --build-arg CONTAINER_VERSION="$CONTAINER_VERSION" -f "$VARIANT_DIR_PATH"/docker/Dockerfile .)
301+
(set -x; docker $BUILD_ACTION $LOG_ARGS -t "$IMAGE":"$IMAGE_TAG" $PLATFORM_ARGS --build-arg CONTAINER_VERSION="$CONTAINER_VERSION" --build_arg IMAGE_NAME="$IMAGE" -f "$VARIANT_DIR_PATH"/docker/Dockerfile .)
302302

303303
# Capture exit code from attempted Docker image build
304304
success=$?

build/arm-none-eabi-plugins/assets/shell/welcome

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
echo ""
2-
echo "\u001b[35mWelcome to the Mad Science Lab $MADSCIENCELAB_VERSION \u001b[0m"
3-
echo "\u001b[37m"
2+
echo "\e[35mWelcome to the Mad Science Lab $MADSCIENCELAB_VERSION \e[0m"
3+
echo "\e[37m"
44
echo " This container includes:"
55
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * Ceedling, Unity, CMock & CException"; fi
66
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * Ruby 3"; fi
@@ -15,6 +15,9 @@ if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * unzip, git & svn for use by
1515
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * tput for use by Beep plugin"; fi
1616
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * Python 3, needed by gcovr"; fi
1717
if [[ "$CONTAINER_PLATFORM" == linux/amd64 ]]; then echo " * Dotnet 8, needed by reportgenerator"; fi
18-
echo ""
19-
echo " To get started, enter \`ceedling help\` at the command line."
20-
echo "\u001b[0m"
18+
echo "\e[0m"
19+
echo " NOTICE: Container user \`$(whoami)\` lacks root priveleges as a security best practice."
20+
echo " This limits installing software and more. See Docker Hub page for container security docs and options."
21+
echo "\e[33m"
22+
echo " To get started, enter \`ceedling help\` at the command line..."
23+
echo "\e[0m"

build/arm-none-eabi-plugins/docker/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ ARG CONTAINER_VERSION
1919
# Capture TARGETPLATFORM as an environment variable in the image
2020
ENV CONTAINER_PLATFORM=$TARGETPLATFORM
2121

22+
# Docker image name used for Metadata, set via Docker build argument
23+
# The command line must include `--build-arg IMAGE_NAME=<name>`
24+
ENV MADSCIENCELAB_IMAGE_NAME=$IMAGE_NAME
25+
2226
# Docker image tag for internal container use, set via Docker build argument
2327
ENV MADSCIENCELAB_VERSION=$CONTAINER_VERSION
2428

@@ -28,8 +32,8 @@ ENV MADSCIENCELAB_VERSION=$CONTAINER_VERSION
2832
##
2933

3034
## Metadata
31-
LABEL org.opencontainers.image.source=https://github.com/ThrowTheSwitch/MadScienceLabDocker
32-
LABEL org.opencontainers.image.url=https://github.com/ThrowTheSwitch/MadScienceLabDocker/blob/master/README.md
35+
LABEL org.opencontainers.image.source=https://github.com/ThrowTheSwitch/MadScienceLabDocker/releases
36+
LABEL org.opencontainers.image.url=https://hub.docker.com/r/throwtheswitch/$MADSCIENCELAB_IMAGE_NAME
3337
LABEL org.opencontainers.image.base.name=docker.io/bitnami/minideb
3438
LABEL org.opencontainers.image.title="Mad Science Lab"
3539
LABEL org.opencontainers.image.description="Contains Ceedling, supporting frameworks, and GNU C toolchain to provide a unit testing and build system environment for C projects"
@@ -115,7 +119,7 @@ RUN set -ex \
115119

116120
# Microsoft Dotnet installation to support `reportgenerator` for `gcov` plugin
117121
# Only available on AMD64 image builds
118-
RUN if [[ $TARGETPLATFORM == "linux/amd64" ]] ; then set -ex \
122+
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then set -ex \
119123
&& dpkg -i /assets/plugins/dotnet/packages-microsoft-prod.deb \
120124
&& apt update \
121125
&& apt install -y \
@@ -159,7 +163,7 @@ USER dev
159163

160164
# Install `reportgenerator` (for `gcov` plugin)
161165
# Only available in AMD64 containers
162-
RUN if [[ $TARGETPLATFORM == "linux/amd64" ]] ; then set -ex \
166+
RUN if [ "$TARGETPLATFORM" == "linux/amd64" ]; then set -ex \
163167
# Install the dotnet tool as global (which means global for the current user vs. a local directory)
164168
&& dotnet tool install --global dotnet-reportgenerator-globaltool \
165169
# Modify the PATH so the new tool is findable
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
echo ""
2-
echo "\u001b[35mWelcome to the Mad Science Lab $MADSCIENCELAB_VERSION \u001b[0m"
3-
echo "\u001b[37m"
2+
echo "\e[35mWelcome to the Mad Science Lab $MADSCIENCELAB_VERSION \e[0m"
3+
echo "\e[37m"
44
echo " This container includes:"
55
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * Ceedling, Unity, CMock & CException"; fi
66
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * Ruby 3"; fi
@@ -9,6 +9,9 @@ if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * Essential build tools (make
99
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * nano for simple text editing"; fi
1010
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * GNU Compiler Collection (gcc, etc.) for ARM"; fi
1111
if [[ "$CONTAINER_PLATFORM" == * ]]; then echo " * Standard C libraries (ARM)"; fi
12-
echo ""
13-
echo " To get started, enter \`ceedling help\` at the command line."
14-
echo "\u001b[0m"
12+
echo "\e[0m"
13+
echo " NOTICE: Container user \`$(whoami)\` lacks root priveleges as a security best practice."
14+
echo " This limits installing software and more. See Docker Hub page for container security docs and options."
15+
echo "\e[33m"
16+
echo " To get started, enter \`ceedling help\` at the command line..."
17+
echo "\e[0m"

build/arm-none-eabi/docker/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ ARG CONTAINER_VERSION
1919
# Capture TARGETPLATFORM as an environment variable in the image
2020
ENV CONTAINER_PLATFORM=$TARGETPLATFORM
2121

22+
# Docker image name used for Metadata, set via Docker build argument
23+
# The command line must include `--build-arg IMAGE_NAME=<name>`
24+
ENV MADSCIENCELAB_IMAGE_NAME=$IMAGE_NAME
25+
2226
# Docker image tag for internal container use, set via Docker build argument
2327
ENV MADSCIENCELAB_VERSION=$CONTAINER_VERSION
2428

@@ -28,8 +32,8 @@ ENV MADSCIENCELAB_VERSION=$CONTAINER_VERSION
2832
##
2933

3034
## Metadata
31-
LABEL org.opencontainers.image.source=https://github.com/ThrowTheSwitch/MadScienceLabDocker
32-
LABEL org.opencontainers.image.url=https://github.com/ThrowTheSwitch/MadScienceLabDocker/blob/master/README.md
35+
LABEL org.opencontainers.image.source=https://github.com/ThrowTheSwitch/MadScienceLabDocker/releases
36+
LABEL org.opencontainers.image.url=https://hub.docker.com/r/throwtheswitch/$MADSCIENCELAB_IMAGE_NAME
3337
LABEL org.opencontainers.image.base.name=docker.io/bitnami/minideb
3438
LABEL org.opencontainers.image.title="Mad Science Lab"
3539
LABEL org.opencontainers.image.description="Contains Ceedling, supporting frameworks, and GNU C toolchain to provide a unit testing and build system environment for C projects"

build/base/templates/Dockerfile.erb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ ARG CONTAINER_VERSION
1919
# Capture TARGETPLATFORM as an environment variable in the image
2020
ENV CONTAINER_PLATFORM=$TARGETPLATFORM
2121

22+
# Docker image name used for Metadata, set via Docker build argument
23+
# The command line must include `--build-arg IMAGE_NAME=<name>`
24+
ENV MADSCIENCELAB_IMAGE_NAME=$IMAGE_NAME
25+
2226
# Docker image tag for internal container use, set via Docker build argument
2327
ENV MADSCIENCELAB_VERSION=$CONTAINER_VERSION
2428

@@ -28,8 +32,8 @@ ENV MADSCIENCELAB_VERSION=$CONTAINER_VERSION
2832
##
2933

3034
## Metadata
31-
LABEL org.opencontainers.image.source=https://github.com/ThrowTheSwitch/MadScienceLabDocker
32-
LABEL org.opencontainers.image.url=https://github.com/ThrowTheSwitch/MadScienceLabDocker/blob/master/README.md
35+
LABEL org.opencontainers.image.source=https://github.com/ThrowTheSwitch/MadScienceLabDocker/releases
36+
LABEL org.opencontainers.image.url=https://hub.docker.com/r/throwtheswitch/$MADSCIENCELAB_IMAGE_NAME
3337
LABEL org.opencontainers.image.base.name=docker.io/bitnami/minideb
3438
LABEL org.opencontainers.image.title="Mad Science Lab"
3539
LABEL org.opencontainers.image.description="Contains Ceedling, supporting frameworks, and GNU C toolchain to provide a unit testing and build system environment for C projects"

0 commit comments

Comments
 (0)