Compare commits
29
Commits
9.0-alpine-23
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a074def041 | ||
|
|
d7375010d2 | ||
|
|
b2cb2502c8 | ||
|
|
51a7cdac0d | ||
|
|
93d03e16d4 | ||
|
|
731661282d | ||
|
|
7e9a5c82fe | ||
|
|
db7719f55c | ||
|
|
df13f6491b | ||
|
|
80ddd47ac6 | ||
|
|
818465eaae | ||
|
|
80e0b90ead | ||
|
|
773a25f302 | ||
|
|
4aa31fe311 | ||
|
|
fffd872ba9 | ||
|
|
63f8fb8681 | ||
|
|
9ae0c2349e | ||
|
|
489b1ccd48 | ||
|
|
16a935cbe5 | ||
|
|
56d78fa030 | ||
|
|
64d72d6c2d | ||
|
|
13ecfe5494 | ||
|
|
cc013b0e35 | ||
|
|
65bdc94059 | ||
|
|
3933b36ff5 | ||
|
|
21e14a466d | ||
|
|
032fa50be0 | ||
|
|
98f51d4e28 | ||
|
|
49cdd9be18 |
@@ -1,6 +1,18 @@
|
|||||||
name: 'Build docker container'
|
name: 'Build docker container'
|
||||||
on:
|
on:
|
||||||
release:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: "Select branch to build"
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- 9.0-alpine-24
|
||||||
|
- 9.0-alpine-23
|
||||||
|
- 9.0-alpine-22
|
||||||
|
- 9.0-alpine-21
|
||||||
|
- 8.0-alpine-22
|
||||||
|
- 8.0-alpine-21
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -10,6 +22,83 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
- name: Set build variables for docker build
|
||||||
|
id: variables-test
|
||||||
|
uses: https://git.claeyscloud.com/david/gitea-actions/conditional-variables@main
|
||||||
|
with:
|
||||||
|
context: |
|
||||||
|
branch=${{ inputs.branch }}
|
||||||
|
rules: |
|
||||||
|
- conditions:
|
||||||
|
- branch == 9.0-alpine-24
|
||||||
|
- branch == 9.0-alpine-23
|
||||||
|
set:
|
||||||
|
DOTNET_SDK_VERSION=9.0
|
||||||
|
DOTNET_RUNTIME_VERSION=9.0.18
|
||||||
|
- conditions:
|
||||||
|
- branch == 9.0-alpine-24
|
||||||
|
set:
|
||||||
|
ALPINE_VERSION=24
|
||||||
|
- name: Dump contexts
|
||||||
|
env:
|
||||||
|
GITEA_CONTEXT: ${{ toJson(gitea) }}
|
||||||
|
JOB_CONTEXT: ${{ toJson(job) }}
|
||||||
|
RUNNER_CONTEXT: ${{ toJson(runner) }}
|
||||||
|
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
|
||||||
|
MATRIX_CONTEXT: ${{ toJson(matrix) }}
|
||||||
|
run: |
|
||||||
|
echo "=== ENVIRONMENT VARIABLES ==="
|
||||||
|
echo '${{ toJson(steps.variables-test.outputs) }}'
|
||||||
|
# echo "$GITEA_CONTEXT"
|
||||||
|
# echo "$JOB_CONTEXT"
|
||||||
|
# echo "$RUNNER_CONTEXT"
|
||||||
|
# echo "$STRATEGY_CONTEXT"
|
||||||
|
# echo "$MATRIX_CONTEXT"
|
||||||
|
- name: Set build variables for docker build
|
||||||
|
id: variables
|
||||||
|
run: |
|
||||||
|
case "${{ inputs.branch }}" in
|
||||||
|
9.0-alpine-24)
|
||||||
|
echo "DOTNET_SDK_VERSION=9.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "DOTNET_RUNTIME_VERSION=9.0.18" >> $GITHUB_OUTPUT
|
||||||
|
echo "ALPINE_VERSION=3.24" >> $GITHUB_OUTPUT
|
||||||
|
echo "IS_LATEST=true" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
9.0-alpine-23)
|
||||||
|
echo "DOTNET_SDK_VERSION=9.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "DOTNET_RUNTIME_VERSION=9.0.18" >> $GITHUB_OUTPUT
|
||||||
|
echo "ALPINE_VERSION=3.23" >> $GITHUB_OUTPUT
|
||||||
|
echo "IS_LATEST=false" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
9.0-alpine-22)
|
||||||
|
echo "DOTNET_SDK_VERSION=9.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "DOTNET_RUNTIME_VERSION=9.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "ALPINE_VERSION=3.22" >> $GITHUB_OUTPUT
|
||||||
|
echo "IS_LATEST=false" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
9.0-alpine-21)
|
||||||
|
echo "DOTNET_SDK_VERSION=9.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "DOTNET_RUNTIME_VERSION=9.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "ALPINE_VERSION=3.21" >> $GITHUB_OUTPUT
|
||||||
|
echo "IS_LATEST=false" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
8.0-alpine-22)
|
||||||
|
echo "DOTNET_SDK_VERSION=8.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "DOTNET_RUNTIME_VERSION=8.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "ALPINE_VERSION=3.22" >> $GITHUB_OUTPUT
|
||||||
|
echo "IS_LATEST=false" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
8.0-alpine-21)
|
||||||
|
echo "DOTNET_SDK_VERSION=8.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "DOTNET_RUNTIME_VERSION=8.0" >> $GITHUB_OUTPUT
|
||||||
|
echo "ALPINE_VERSION=3.21" >> $GITHUB_OUTPUT
|
||||||
|
echo "IS_LATEST=false" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported branch"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
- name: Install Docker
|
- name: Install Docker
|
||||||
run: |
|
run: |
|
||||||
echo "Checking docker installation"
|
echo "Checking docker installation"
|
||||||
@@ -32,13 +121,13 @@ jobs:
|
|||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.documentation=https://git.claeyscloud.com/david/epg-info-docker/src/branch/main/README.md
|
org.opencontainers.image.documentation=https://git.claeyscloud.com/david/net-base/README.md
|
||||||
images: |
|
images: |
|
||||||
git.claeyscloud.com/david/net-base
|
git.claeyscloud.com/david/net-base
|
||||||
tags: |
|
tags: |
|
||||||
type=semver,pattern={{raw}}
|
type=raw,value=${{ inputs.branch }}
|
||||||
type=sha
|
type=raw,value=latest,enable=${{ steps.variables.outputs.IS_LATEST == 'true' }}
|
||||||
type=semver,pattern={{version}}
|
type=sha
|
||||||
- name: Generate random password for certificate
|
- name: Generate random password for certificate
|
||||||
id: password
|
id: password
|
||||||
run:
|
run:
|
||||||
@@ -46,7 +135,11 @@ jobs:
|
|||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: https://github.com/docker/build-push-action@v5
|
uses: https://github.com/docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
build-args: CERT_PASSWORD=${{ steps.password.outputs.secret }}
|
build-args: |
|
||||||
|
CERT_PASSWORD=${{ steps.password.outputs.secret }}
|
||||||
|
DOTNET_SDK_VERSION=${{ steps.variables.outputs.DOTNET_SDK_VERSION }}
|
||||||
|
DOTNET_RUNTIME_VERSION=${{ steps.variables.outputs.DOTNET_RUNTIME_VERSION }}
|
||||||
|
ALPINE_VERSION=${{ steps.variables.outputs.ALPINE_VERSION }}
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
|||||||
+5
-5
@@ -1,9 +1,9 @@
|
|||||||
ARG CERT_PASSWORD
|
ARG CERT_PASSWORD
|
||||||
ARG DOTNET_SDK_VERSION=9.0.300
|
ARG DOTNET_SDK_VERSION=10.0.100
|
||||||
ARG DOTNET_RUNTIME_VERSION=9.0.5
|
ARG DOTNET_RUNTIME_VERSION=10.0.0
|
||||||
ARG ALPINE_VERSION=3.21
|
ARG ALPINE_VERSION=3.22
|
||||||
ARG CONFIG_DIRECTORY_ARG=/config
|
ARG CONFIG_DIRECTORY_ARG=/config
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_SDK_VERSION}-alpine${ALPINE_VERSION}-amd64 AS build-env
|
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_SDK_VERSION}-alpine${ALPINE_VERSION} AS build-env
|
||||||
ARG CONFIG_DIRECTORY_ARG
|
ARG CONFIG_DIRECTORY_ARG
|
||||||
ENV CONFIG_DIRECTORY=$CONFIG_DIRECTORY_ARG
|
ENV CONFIG_DIRECTORY=$CONFIG_DIRECTORY_ARG
|
||||||
ARG CERT_PASSWORD
|
ARG CERT_PASSWORD
|
||||||
@@ -13,7 +13,7 @@ RUN mkdir $CONFIG_DIRECTORY \
|
|||||||
&& rm -rf /var/cache/apk/* \
|
&& rm -rf /var/cache/apk/* \
|
||||||
&& dotnet dev-certs https --export-path /config/aspnetapp.pem --password "$CERT_PASSWORD" --format PEM
|
&& dotnet dev-certs https --export-path /config/aspnetapp.pem --password "$CERT_PASSWORD" --format PEM
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_RUNTIME_VERSION}-alpine${ALPINE_VERSION}-amd64
|
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_RUNTIME_VERSION}-alpine${ALPINE_VERSION}
|
||||||
ARG CONFIG_DIRECTORY_ARG
|
ARG CONFIG_DIRECTORY_ARG
|
||||||
ENV CONFIG_DIRECTORY=$CONFIG_DIRECTORY_ARG
|
ENV CONFIG_DIRECTORY=$CONFIG_DIRECTORY_ARG
|
||||||
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
|
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ docker build --build-arg CERT_PASSWORD=supersecretpassword . -t net-base
|
|||||||
| Argument | Description | Default |
|
| Argument | Description | Default |
|
||||||
|-----------------------------------------------------|-------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
|
|-----------------------------------------------------|-------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|
|
||||||
| CERT_PASSWORD | The password for the generated certificate | N/A **(required)** |
|
| CERT_PASSWORD | The password for the generated certificate | N/A **(required)** |
|
||||||
| DOTNET_SDK_VERSION | The [SDK](https://mcr.microsoft.com/en-us/artifact/mar/dotnet/sdk/tags) version used to generate the development certificate | 9.0.300 |
|
| DOTNET_SDK_VERSION | The [SDK](https://mcr.microsoft.com/en-us/artifact/mar/dotnet/sdk/tags) version used to generate the development certificate | 10.0.100 |
|
||||||
| DOTNET_RUNTIME_VERSION | The [runtime](https://mcr.microsoft.com/en-us/artifact/mar/dotnet/aspnet/tags) version used as a base | 9.0.5 |
|
| DOTNET_RUNTIME_VERSION | The [runtime](https://mcr.microsoft.com/en-us/artifact/mar/dotnet/aspnet/tags) version used as a base | 10.0.0 |
|
||||||
| ALPINE_VERSION | The version of [alpine linux](https://www.alpinelinux.org/) used as a base| 3.21 |
|
| ALPINE_VERSION | The version of [alpine linux](https://www.alpinelinux.org/) used as a base| 3.22 |
|
||||||
|
|
||||||
## Security implications
|
## Security implications
|
||||||
|
|
||||||
@@ -93,8 +93,25 @@ Depending on your use-case you event might consider to use docker networking in
|
|||||||
The included certificate is generated through the _dotnet dev-certs_ command. This is a very convenient and suitable way to generate development certificates through the dotnet SDK.
|
The included certificate is generated through the _dotnet dev-certs_ command. This is a very convenient and suitable way to generate development certificates through the dotnet SDK.
|
||||||
|
|
||||||
The password used to generate the certificate is randomly generated through the `openssl rand -base64 12` at build time.
|
The password used to generate the certificate is randomly generated through the `openssl rand -base64 12` at build time.
|
||||||
The build agent used for the build is hosted on my own infrastructure but I don't have any access to it (neither do I intend to do so).<br/>
|
If you inspect the image layers you'll able to easily see it.
|
||||||
However if you feel uncomfortable with this fact, feel free to build the image yourself.
|
I think this is fine for development purposes and just want to get things up and running, although this is not recommended for production use at all.
|
||||||
|
You can generate your own password and certificates in the following way :
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# generate a random secure password
|
||||||
|
openssl rand -base64 12
|
||||||
|
# use the .net cli to generate your own certificates with your chosen password
|
||||||
|
dotnet dev-certs https --export-path /config/aspnetapp.pem --password "YOUR PASSWORD" --format PEM
|
||||||
|
```
|
||||||
|
After this you only need to map your own certificates with the **ASPNETCORE_Kestrel__Certificates__** variables.
|
||||||
|
|
||||||
|
### Versioning
|
||||||
|
|
||||||
|
Recently Microsoft decided to update the base images to alpine 3.22.
|
||||||
|
Before 2025-11-11 the latest supported version was alpine 3.21.
|
||||||
|
In order to support these changes the naming scheme will need to be changed.
|
||||||
|
Going forward specefic tags will be vailable for the different versions: by example `9.0.11-alpine-21` and `9.0.11-alpine-22`.
|
||||||
|
By default alpine 22 will be used and the older versions will be supported as long Microsoft does.
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user