Skip to content

Commit 31fd98c

Browse files
committed
chore(container): adjust COPY commands to include trailing slashes
1 parent ee00508 commit 31fd98c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS builder
77
WORKDIR /src
88

99
# Restore dependencies
10-
COPY src/Dotnet.Samples.AspNetCore.WebApi/*.csproj ./Dotnet.Samples.AspNetCore.WebApi/
10+
COPY src/Dotnet.Samples.AspNetCore.WebApi/*.csproj ./Dotnet.Samples.AspNetCore.WebApi/
1111
RUN dotnet restore ./Dotnet.Samples.AspNetCore.WebApi
1212

1313
# Copy source code and pre-seeded SQLite database
14-
COPY src/Dotnet.Samples.AspNetCore.WebApi ./Dotnet.Samples.AspNetCore.WebApi
14+
COPY src/Dotnet.Samples.AspNetCore.WebApi/ ./Dotnet.Samples.AspNetCore.WebApi/
1515

1616
WORKDIR /src/Dotnet.Samples.AspNetCore.WebApi
1717

@@ -41,21 +41,21 @@ ENV ASPNETCORE_URLS=http://+:9000
4141
ENV ASPNETCORE_ENVIRONMENT=Production
4242

4343
# Copy published app from builder
44-
COPY --from=builder /app/publish .
44+
COPY --from=builder /app/publish/ .
4545

4646
# Copy metadata docs for container registries (e.g.: GitHub Container Registry)
4747
COPY --chmod=444 README.md ./
48-
COPY --chmod=555 assets ./assets
48+
COPY --chmod=555 assets/ ./assets/
4949

5050
# https://rules.sonarsource.com/docker/RSPEC-6504/
5151

5252
# Copy entrypoint and healthcheck scripts
5353
COPY --chmod=555 scripts/entrypoint.sh ./entrypoint.sh
5454
COPY --chmod=555 scripts/healthcheck.sh ./healthcheck.sh
55-
56-
57-
# Copy pre-seeded SQLite database as init bundle
58-
COPY --from=builder /src/Dotnet.Samples.AspNetCore.WebApi/storage/players-sqlite3.db ./docker-compose/players-sqlite3.db
55+
# The 'hold' is our storage compartment within the image. Here, we copy a
56+
# pre-seeded SQLite database file, which Compose will mount as a persistent
57+
# 'storage' volume when the container starts up.
58+
COPY --from=builder /src/Dotnet.Samples.AspNetCore.WebApi/storage/players-sqlite3.db ./hold/players-sqlite3.db
5959

6060
# Add non-root user and make volume mount point writable
6161
RUN adduser --system --disabled-password --group aspnetcore && \

scripts/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
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)