diff options
| author | Joel Stålnacke <joel@saker.fi> | 2025-09-28 15:27:05 +0300 |
|---|---|---|
| committer | Joel Stålnacke <joel@saker.fi> | 2025-09-28 15:27:05 +0300 |
| commit | 29c2b9089e70ef9b729e1a6a191848ca58fb470e (patch) | |
| tree | eca46751d34c6817a33e4b6882faed4a65321b57 | |
| parent | 96aea2535a85c615111496f6d077eb0e9c9fa644 (diff) | |
Containerise app
| -rw-r--r-- | .dockerignore | 11 | ||||
| -rw-r--r-- | Dockerfile | 46 | ||||
| -rw-r--r-- | compose.yaml | 16 |
3 files changed, 73 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..140aeb5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +**/bin/ +**/obj/ +**/*.fs.js +**/node_modules +**/fable_modules + +LICENSE.txt +README.md + +Dockerfile +compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..50dd7c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build + +# Install dependencies +WORKDIR /build + +RUN apk add pnpm + +COPY \ + Aamukampa.Frontend/package.json \ + Aamukampa.Frontend/pnpm-lock.yaml \ + Aamukampa.Frontend/ +RUN pnpm install -C Aamukampa.Frontend/ + +COPY .config ./ +RUN dotnet tool restore + +COPY Aamukampa.sln ./ +COPY Aamukampa.Frontend/*.fsproj Aamukampa.Frontend/ +COPY Aamukampa.Core/*.fsproj Aamukampa.Core/ +COPY Aamukampa.Web/*.fsproj Aamukampa.Web/ +RUN dotnet restore + +# Copy shared Core library +COPY Aamukampa.Core/ Aamukampa.Core/ + +# Build frontend +WORKDIR Aamukampa.Frontend + +COPY Aamukampa.Frontend/ ./ +RUN dotnet fable --noRestore +RUN pnpm build + +# Build backend +WORKDIR /build + +COPY Aamukampa.Web/ Aamukampa.Web/ +RUN dotnet publish Aamukampa.Web --no-restore -o publish + +FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine + +WORKDIR /app +USER app + +COPY --from=build --chown=app:app /build/publish /app + +CMD [ "./Aamukampa.Web" ] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..7a03b49 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,16 @@ +services: + web: + build: . + ports: + - 8080:8080 + develop: + watch: + - action: rebuild + path: Aamukampa.Frontend/ + - action: rebuild + path: Aamukampa.Core/ + - action: rebuild + path: Aamukampa.Web/ + - action: sync + path: Aamukampa.Web/appsettings*.json + target: /app/ |
