aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore11
-rw-r--r--Dockerfile46
-rw-r--r--compose.yaml16
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/