diff --git a/Dockerfile b/Dockerfile index 1365b22..f877b4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,7 @@ WORKDIR /app # Copy the binary from the builder stage COPY --from=builder /app/server /app/server +RUN chmod +x /app/server # Copy static and template assets from the project source COPY --from=builder /build/static /app/static @@ -46,10 +47,13 @@ COPY --from=builder /build/templates /app/templates # Ensure the app user owns the working dir (DB file created here at runtime) RUN chown -R app:app /app +# Create a dedicated subdirectory for persistable data (mounted as a volume) +RUN mkdir -p /app/data + USER app # Expose the HTTP port EXPOSE 8080 # Default command -CMD ["./server", "-addr", ":8080"] +CMD ["/app/server", "-addr", ":8080", "-db", "/app/data/state.db"] diff --git a/docker-compose.yml b/docker-compose.yml index 36080de..955c998 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,12 +5,11 @@ services: build: context: . dockerfile: Dockerfile - container_name: uportal ports: - "8080:8080" volumes: - # Bind mount to persist the SQLite database file locally in ./data/ - - ./data:/app + # Bind mount only the data subdirectory, so /app/server and assets are NOT overwritten + - ./data:/app/data environment: LOG_LEVEL: info # Optional configuration (uncomment as needed):