Skip to content

Commit a42c02d

Browse files
committed
chore(container): adjust COPY commands to include trailing slashes for folders
1 parent ce206a3 commit a42c02d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

Dockerfile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ LABEL org.opencontainers.image.source="https://github.com/nanotaboada/python-sam
3535

3636
# Copy metadata docs for container registries (e.g.: GitHub Container Registry)
3737
COPY README.md ./
38-
COPY assets ./assets
38+
COPY assets/ ./assets/
3939

4040
# Copy pre-built wheels from builder
41-
COPY --from=builder /app/wheelhouse /app/wheelhouse
41+
COPY --from=builder /app/wheelhouse/ /app/wheelhouse/
4242

4343
# Install dependencies
4444
COPY requirements.txt .
@@ -47,19 +47,21 @@ RUN pip install --no-cache-dir --no-index --find-links /app/wheelhouse -r requir
4747

4848
# Copy application source code
4949
COPY main.py ./
50-
COPY databases ./databases
51-
COPY models ./models
52-
COPY routes ./routes
53-
COPY schemas ./schemas
54-
COPY services ./services
50+
COPY databases/ ./databases/
51+
COPY models/ ./models/
52+
COPY routes/ ./routes/
53+
COPY schemas/ ./schemas/
54+
COPY services/ ./services/
5555

5656
# https://rules.sonarsource.com/docker/RSPEC-6504/
5757

5858
# Copy entrypoint and healthcheck scripts
5959
COPY --chmod=755 scripts/entrypoint.sh ./entrypoint.sh
6060
COPY --chmod=755 scripts/healthcheck.sh ./healthcheck.sh
61-
# Copy pre-seeded SQLite database as init bundle
62-
COPY --chmod=755 storage ./docker-compose
61+
# The 'hold' is our storage compartment within the image. Here, we copy a
62+
# pre-seeded SQLite database file, which Compose will mount as a persistent
63+
# 'storage' volume when the container starts up.
64+
COPY --chmod=755 storage/ ./hold/
6365

6466
# Add non-root user and make volume mount point writable
6567
RUN adduser --system --disabled-password --group fastapi && \
@@ -68,7 +70,6 @@ RUN adduser --system --disabled-password --group fastapi && \
6870

6971
ENV PYTHONUNBUFFERED=1
7072

71-
# Drop privileges
7273
USER fastapi
7374

7475
EXPOSE 9000

scripts/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
IMAGE_STORAGE_PATH="/app/docker-compose/players-sqlite3.db"
4+
IMAGE_STORAGE_PATH="/app/hold/players-sqlite3.db"
55
VOLUME_STORAGE_PATH="/storage/players-sqlite3.db"
66

77
echo "✔ Starting container..."

0 commit comments

Comments
 (0)