Skip to content

Commit fe33614

Browse files
authored
Merge pull request #26 from JohanDevl/develop
Add version information to Docker images
2 parents 3c04b38 + b3dfaef commit fe33614

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

.github/workflows/docker-publish.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
steps:
4343
- name: Checkout repository
4444
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
4547

4648
# Install the cosign tool except on PR
4749
# https://github.com/sigstore/cosign-installer
@@ -51,6 +53,20 @@ jobs:
5153
with:
5254
cosign-release: "v2.2.4"
5355

56+
# Get version information for main branch
57+
- name: Get version info
58+
id: version
59+
if: github.ref == 'refs/heads/main'
60+
run: |
61+
# Get latest version tag
62+
LATEST_TAG=$(git tag -l "v*" | grep -v "-" | sort -V | tail -n 1)
63+
if [ -z "$LATEST_TAG" ]; then
64+
LATEST_TAG="v1.0.0"
65+
fi
66+
# Store the version without the 'v' prefix
67+
VERSION=${LATEST_TAG#v}
68+
echo "version=$VERSION" >> $GITHUB_OUTPUT
69+
5470
# Set up BuildKit Docker container builder to be able to build
5571
# multi-platform images and export cache
5672
# https://github.com/docker/setup-buildx-action
@@ -100,6 +116,8 @@ jobs:
100116
cache-from: type=gha
101117
cache-to: type=gha,mode=max
102118
outputs: type=docker,dest=/tmp/docker-image.tar
119+
build-args: |
120+
APP_VERSION=${{ steps.version.outputs.version || 'develop' }}
103121
104122
# Export Docker image for release
105123
- name: Export Docker image

Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
FROM alpine:3.18
22

3+
# Define build arguments for version
4+
ARG APP_VERSION=dev
5+
6+
# Add version labels
7+
LABEL org.opencontainers.image.version=$APP_VERSION \
8+
org.opencontainers.image.title="Export Trakt 4 Letterboxd" \
9+
org.opencontainers.image.description="Tool for exporting Trakt.tv history to Letterboxd compatible format"
10+
311
# Install required packages
412
RUN apk add --no-cache \
513
bash \
@@ -32,7 +40,8 @@ ENV DOSLOG=/app/logs \
3240
BACKUP_DIR=/app/backup \
3341
CONFIG_DIR=/app/config \
3442
CRON_SCHEDULE="" \
35-
EXPORT_OPTION="normal"
43+
EXPORT_OPTION="normal" \
44+
APP_VERSION=$APP_VERSION
3645

3746
# Set volume for persistent data
3847
VOLUME ["/app/logs", "/app/copy", "/app/backup", "/app/config"]

docker-entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ log_message() {
1616
esac
1717
}
1818

19+
# Show version information
20+
show_version() {
21+
log_message "INFO" "Starting Export Trakt 4 Letterboxd container - Version: ${APP_VERSION:-unknown}"
22+
}
23+
1924
# Debug function for file and directory information
2025
debug_file_info() {
2126
local path="$1"
@@ -61,6 +66,7 @@ debug_file_info() {
6166

6267
# Initial system information
6368
log_message "INFO" "Starting Docker container for Export_Trakt_4_Letterboxd"
69+
show_version
6470
log_message "DEBUG" "Container environment:"
6571
log_message "DEBUG" "User: $(id)"
6672
log_message "DEBUG" "Working directory: $(pwd)"

0 commit comments

Comments
 (0)