From 39c664ab1ad37ce2e1f18bbf295f7a8f2f215027 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Thu, 5 Jun 2025 23:29:39 -0400 Subject: [PATCH] fix: update Dockerfiles with metadata labels and improve build process --- backend/Dockerfile | 20 ++++++-- backend/server/adventures/views/stats_view.py | 2 +- backend/server/requirements.txt | 2 +- documentation/docs/install/getting_started.md | 2 +- documentation/docs/install/quick_start.md | 5 +- documentation/index.md | 2 +- frontend/Dockerfile | 46 ++++++++++++------- 7 files changed, 52 insertions(+), 27 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index fae48fb..57d7ab2 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,11 +1,23 @@ # Use the official Python slim image as the base image -FROM python:3.10-slim +FROM python:3.13-slim -LABEL Developers="Sean Morley" +# Metadata labels for the AdventureLog image +LABEL maintainer="Sean Morley" \ + version="v0.9.0" \ + description="AdventureLog โ€” the ultimate self-hosted travel companion." \ + org.opencontainers.image.title="AdventureLog" \ + org.opencontainers.image.description="AdventureLog is a self-hosted travel companion that helps you plan, track, and share your adventures." \ + org.opencontainers.image.version="v0.9.0" \ + org.opencontainers.image.authors="Sean Morley" \ + org.opencontainers.image.url="https://raw.githubusercontent.com/seanmorley15/AdventureLog/refs/heads/main/brand/banner.png" \ + org.opencontainers.image.source="https://github.com/seanmorley15/AdventureLog" \ + org.opencontainers.image.vendor="Sean Morley" \ + org.opencontainers.image.created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ + org.opencontainers.image.licenses="GPL-3.0" # Set environment variables -ENV PYTHONDONTWRITEBYTECODE 1 -ENV PYTHONUNBUFFERED 1 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 # Set the working directory WORKDIR /code diff --git a/backend/server/adventures/views/stats_view.py b/backend/server/adventures/views/stats_view.py index 4b3a524..8b56f26 100644 --- a/backend/server/adventures/views/stats_view.py +++ b/backend/server/adventures/views/stats_view.py @@ -14,7 +14,7 @@ class StatsViewSet(viewsets.ViewSet): """ A simple ViewSet for listing the stats of a user. """ - @action(detail=False, methods=['get'], url_path='counts/(?P[\w.@+-]+)') + @action(detail=False, methods=['get'], url_path=r'counts/(?P[\w.@+-]+)') def counts(self, request, username): if request.user.username == username: user = get_object_or_404(User, username=username) diff --git a/backend/server/requirements.txt b/backend/server/requirements.txt index 1ccfcc8..19ff3c5 100644 --- a/backend/server/requirements.txt +++ b/backend/server/requirements.txt @@ -10,7 +10,7 @@ Pillow whitenoise django-resized django-geojson -setuptools +setuptools<81 gunicorn==23.0.0 qrcode==8.0 slippers==0.6.2 diff --git a/documentation/docs/install/getting_started.md b/documentation/docs/install/getting_started.md index c67823a..87c5bee 100644 --- a/documentation/docs/install/getting_started.md +++ b/documentation/docs/install/getting_started.md @@ -7,7 +7,7 @@ AdventureLog can be installed in a variety of ways, depending on your platform o ::: tip Quick Start Script **The fastest way to get started:** [Install AdventureLog with a single command โ†’](quick_start.md) -Perfect for most users. Zero guesswork. Maximum adventure. ๐Ÿš€ +Perfect for and Docker beginners. ::: ## ๐Ÿณ Popular Installation Methods diff --git a/documentation/docs/install/quick_start.md b/documentation/docs/install/quick_start.md index 4395656..64dbdce 100644 --- a/documentation/docs/install/quick_start.md +++ b/documentation/docs/install/quick_start.md @@ -29,9 +29,8 @@ The script automatically: 1. Verifies Docker is installed and running 2. Downloads `docker-compose.yml` and `.env` 3. Prompts you for domain and port settings -4. Launches AdventureLog -5. Waits for services to start -6. Prints success info with next steps +4. Waits for services to start +5. Prints success info with next steps ## ๐Ÿงผ Uninstall diff --git a/documentation/index.md b/documentation/index.md index fe84544..8103bc9 100644 --- a/documentation/index.md +++ b/documentation/index.md @@ -156,7 +156,7 @@ Join thousands of travelers sharing tips, contributing code, and building the fu ### ๐Ÿš€ **Open Source Freedom** -GPL licensed, fully transparent, and built for the community. By travelers, for travelers. +GPL 3.0 licensed, fully transparent, and built for the community. By travelers, for travelers. diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 15450d4..ffed0a9 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,35 +1,49 @@ # Use this image as the platform to build the app FROM node:22-alpine AS external-website -# A small line inside the image to show who made it -LABEL Developers="Sean Morley" +# Metadata labels for the AdventureLog image +LABEL maintainer="Sean Morley" \ + version="v0.9.0" \ + description="AdventureLog โ€” the ultimate self-hosted travel companion." \ + org.opencontainers.image.title="AdventureLog" \ + org.opencontainers.image.description="AdventureLog is a self-hosted travel companion that helps you plan, track, and share your adventures." \ + org.opencontainers.image.version="v0.9.0" \ + org.opencontainers.image.authors="Sean Morley" \ + org.opencontainers.image.url="https://raw.githubusercontent.com/seanmorley15/AdventureLog/refs/heads/main/brand/banner.png" \ + org.opencontainers.image.source="https://github.com/seanmorley15/AdventureLog" \ + org.opencontainers.image.vendor="Sean Morley" \ + org.opencontainers.image.created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ + org.opencontainers.image.licenses="GPL-3.0" # The WORKDIR instruction sets the working directory for everything that will happen next WORKDIR /app -# Copy all local files into the image +# Install pnpm globally first +RUN npm install -g pnpm + +# Copy package files first for better Docker layer caching +COPY package.json pnpm-lock.yaml* ./ + +# Clean install all node modules using pnpm with frozen lockfile +RUN pnpm install --frozen-lockfile + +# Copy the rest of the application files COPY . . # Remove the development .env file if present RUN rm -f .env -# Install pnpm -RUN npm install -g pnpm - -# Clean install all node modules using pnpm -RUN pnpm install - # Build SvelteKit app RUN pnpm run build +# Make startup script executable +RUN chmod +x ./startup.sh + +# Change to non-root user for security +USER node:node + # Expose the port that the app is listening on EXPOSE 3000 -# Run the app -RUN chmod +x ./startup.sh - -# The USER instruction sets the user name to use as the default user for the remainder of the current stage -USER node:node - # Run startup.sh instead of the default command -CMD ["./startup.sh"] +CMD ["./startup.sh"] \ No newline at end of file