Skip to content

Commit 08a5d0d

Browse files
authored
Add build arguments for Alpine and OpenSSL versions in Docker setup (#6)
2 parents 38df78e + 7ff15d5 commit 08a5d0d

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

.github/workflows/publish-image.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ jobs:
4848
push: true
4949
tags: ${{ steps.meta.outputs.tags }}
5050
labels: ${{ steps.meta.outputs.labels }}
51-
cache-from: type=gha
51+
cache-from: type=gha
52+
build-args: |
53+
ALPINE_VERSION=3.21.3
54+
OPENSSL_VERSION=3.3.3-r0
55+

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
FROM alpine:3.21.3
1+
ARG ALPINE_VERSION=3.21.3
2+
FROM alpine:${ALPINE_VERSION}
23

34
# Install openssl and bash for better scripting
4-
RUN apk add --no-cache openssl bash
5+
ARG OPENSSL_VERSION=3.3.3-r0
6+
RUN apk add --no-cache openssl=${OPENSSL_VERSION} bash
57

68
# Set working directory
79
WORKDIR /app

docker/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,32 @@ Should see tls.crt tls.key ca.crt in /certs
130130
docker exec -it key2pfx-dev bash
131131
132132
cd /certs
133+
```
134+
135+
# Build with custom version
136+
137+
Docker compose
138+
139+
```yaml
140+
key2pfx:
141+
container_name: key2pfx-dev
142+
# entrypoint: ["/bin/bash", "-c"]
143+
# command: ["sleep infinity"]
144+
image: key2pfx:latest
145+
build:
146+
context: ../
147+
dockerfile: ./Dockerfile
148+
args:
149+
ALPINE_VERSION: 3.21.3
150+
OPENSSL_VERSION: 3.3.3-r0
151+
```
152+
153+
```bash
154+
docker compose -f docker-compose-dev.yaml build --no-cache
155+
```
156+
157+
Docker
158+
159+
```bash
160+
docker build --build-arg ALPINE_VERSION=3.21.3 --build-arg OPENSSL_VERSION=3.3.3-r0 -t key2pfx:dev .
133161
```

docker/docker-compose-dev.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ services:
77
build:
88
context: ../
99
dockerfile: ./Dockerfile
10+
args:
11+
ALPINE_VERSION: 3.21.3
12+
OPENSSL_VERSION: 3.3.3-r0
1013
environment:
1114
- CRT=/certs/tls.crt
1215
- KEY=/certs/tls.key

0 commit comments

Comments
 (0)