diff --git a/.devcontainer/devcontainer.json b/.devcontainer.disabled/devcontainer.json
similarity index 100%
rename from .devcontainer/devcontainer.json
rename to .devcontainer.disabled/devcontainer.json
diff --git a/.devcontainer/on-create.sh b/.devcontainer.disabled/on-create.sh
similarity index 100%
rename from .devcontainer/on-create.sh
rename to .devcontainer.disabled/on-create.sh
diff --git a/Dockerfile.dotnet b/Dockerfile.dotnet
new file mode 100644
index 0000000..ffdccaa
--- /dev/null
+++ b/Dockerfile.dotnet
@@ -0,0 +1,37 @@
+# Stage 1: Build stage
+FROM mcr.microsoft.com/dotnet/sdk:10.0 AS builder
+
+WORKDIR /src
+
+# Copy project files
+COPY dotnet/SimpleSocialMediaApplication/ .
+
+# Restore and build
+RUN dotnet restore
+RUN dotnet publish -c Release -o /app/publish
+
+# Stage 2: Runtime stage
+FROM mcr.microsoft.com/dotnet/aspnet:10.0
+
+WORKDIR /app
+
+# Set environment variables
+ENV ASPNETCORE_URLS=http://+:8000 \
+ DOTNET_URLS=http://+:8000
+
+# Install curl for health checks
+RUN apt-get update && apt-get install -y curl && \
+ rm -rf /var/lib/apt/lists/*
+
+# Copy published application from builder
+COPY --from=builder /app/publish .
+
+# Expose port
+EXPOSE 8000
+
+# Health check
+HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
+ CMD curl -f http://localhost:8000 || exit 1
+
+# Run the application
+CMD ["dotnet", "SimpleSocialMediaApplication.dll"]
diff --git a/Dockerfile.java b/Dockerfile.java
new file mode 100644
index 0000000..8e2a8d9
--- /dev/null
+++ b/Dockerfile.java
@@ -0,0 +1,41 @@
+# Stage 1: Build stage
+FROM mcr.microsoft.com/openjdk/jdk:21-ubuntu AS builder
+
+WORKDIR /app
+
+# Install Maven
+RUN apt-get update && apt-get install -y maven && rm -rf /var/lib/apt/lists/*
+
+# Copy Maven files
+COPY java/socialapp/pom.xml .
+COPY java/socialapp/src ./src
+
+# Build the application
+RUN mvn clean package -DskipTests
+
+# Stage 2: Runtime stage
+FROM mcr.microsoft.com/openjdk/jdk:21-ubuntu
+
+WORKDIR /app
+
+# Set environment variables
+ENV PATH="/usr/local/openjdk-21/bin:${PATH}" \
+ JAVA_HOME="/usr/local/openjdk-21"
+
+# Install SQLite and create database
+RUN apt-get update && apt-get install -y sqlite3 curl && \
+ rm -rf /var/lib/apt/lists/* && \
+ sqlite3 /app/sns_api.db < /dev/null
+
+# Copy the built JAR from builder stage
+COPY --from=builder /app/target/socialapp-*.jar /app/socialapp.jar
+
+# Expose port
+EXPOSE 8080
+
+# Health check
+HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
+ CMD curl -f http://localhost:8080/actuator/health || exit 1
+
+# Run the application
+CMD ["java", "-jar", "/app/socialapp.jar"]
diff --git a/compose.yaml b/compose.yaml
new file mode 100644
index 0000000..b2ad429
--- /dev/null
+++ b/compose.yaml
@@ -0,0 +1,59 @@
+services:
+ contoso-backend:
+ build:
+ context: .
+ dockerfile: Dockerfile.java
+ image: contoso-backend:latest
+ container_name: contoso-backend
+ ports:
+ - "8080:8080"
+ environment:
+ - SPRING_PROFILES_ACTIVE=prod
+ - CODESPACE_NAME=${CODESPACE_NAME:-local}
+ - GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN=${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-localhost}
+ volumes:
+ - backend-data:/app/data
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
+ interval: 30s
+ timeout: 3s
+ retries: 3
+ start_period: 5s
+ networks:
+ - contoso-network
+ restart: unless-stopped
+
+ contoso-frontend:
+ build:
+ context: .
+ dockerfile: Dockerfile.dotnet
+ image: contoso-frontend:latest
+ container_name: contoso-frontend
+ ports:
+ - "5000:8000"
+ environment:
+ - ASPNETCORE_ENVIRONMENT=Production
+ - ASPNETCORE_URLS=http://+:8000
+ - API_BASE_URL=http://contoso-backend:8080
+ - CODESPACE_NAME=${CODESPACE_NAME:-local}
+ - GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN=${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-localhost}
+ depends_on:
+ contoso-backend:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8000"]
+ interval: 30s
+ timeout: 3s
+ retries: 3
+ start_period: 10s
+ networks:
+ - contoso-network
+ restart: unless-stopped
+
+volumes:
+ backend-data:
+ driver: local
+
+networks:
+ contoso-network:
+ driver: bridge
diff --git a/dotnet/SimpleSocialMediaApplication/App.razor b/dotnet/SimpleSocialMediaApplication/App.razor
new file mode 100644
index 0000000..a8a79e5
--- /dev/null
+++ b/dotnet/SimpleSocialMediaApplication/App.razor
@@ -0,0 +1,6 @@
+
Current count: @currentCount
+ + + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } +} diff --git a/dotnet/SimpleSocialMediaApplication/Pages/Home.razor b/dotnet/SimpleSocialMediaApplication/Pages/Home.razor new file mode 100644 index 0000000..9001e0b --- /dev/null +++ b/dotnet/SimpleSocialMediaApplication/Pages/Home.razor @@ -0,0 +1,7 @@ +@page "/" + +Sorry, the content you are looking for does not exist.
\ No newline at end of file diff --git a/dotnet/SimpleSocialMediaApplication/Pages/Weather.razor b/dotnet/SimpleSocialMediaApplication/Pages/Weather.razor new file mode 100644 index 0000000..3ea2b1c --- /dev/null +++ b/dotnet/SimpleSocialMediaApplication/Pages/Weather.razor @@ -0,0 +1,57 @@ +@page "/weather" +@inject HttpClient Http + +This component demonstrates fetching data from the server.
+ +@if (forecasts == null) +{ +Loading...
+} +else +{ +| Date | +Temp. (C) | +Temp. (F) | +Summary | +
|---|---|---|---|
| @forecast.Date.ToShortDateString() | +@forecast.TemperatureC | +@forecast.TemperatureF | +@forecast.Summary | +
`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\n\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n\n// Abbreviations\n//\n// 1. Add the correct text decoration in Chrome, Edge, Opera, and Safari.\n// 2. Add explicit cursor to indicate changed behavior.\n// 3. Prevent the text-decoration to be skipped.\n\nabbr[title] {\n text-decoration: underline dotted; // 1\n cursor: help; // 2\n text-decoration-skip-ink: none; // 3\n}\n\n\n// Address\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\n\n// Lists\n\nol,\nul {\n padding-left: 2rem;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\n// 1. Undo browser default\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // 1\n}\n\n\n// Blockquote\n\nblockquote {\n margin: 0 0 1rem;\n}\n\n\n// Strong\n//\n// Add the correct font weight in Chrome, Edge, and Safari\n\nb,\nstrong {\n font-weight: $font-weight-bolder;\n}\n\n\n// Small\n//\n// Add the correct font size in all browsers\n\nsmall {\n @include font-size($small-font-size);\n}\n\n\n// Mark\n\nmark {\n padding: $mark-padding;\n color: var(--#{$prefix}highlight-color);\n background-color: var(--#{$prefix}highlight-bg);\n}\n\n\n// Sub and Sup\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n\nsub,\nsup {\n position: relative;\n @include font-size($sub-sup-font-size);\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n// Links\n\na {\n color: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-opacity, 1));\n text-decoration: $link-decoration;\n\n &:hover {\n --#{$prefix}link-color-rgb: var(--#{$prefix}link-hover-color-rgb);\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([class]) {\n &,\n &:hover {\n color: inherit;\n text-decoration: none;\n }\n}\n\n\n// Code\n\npre,\ncode,\nkbd,\nsamp {\n font-family: $font-family-code;\n @include font-size(1em); // Correct the odd `em` font sizing in all browsers.\n}\n\n// 1. Remove browser default top margin\n// 2. Reset browser default of `1em` to use `rem`s\n// 3. Don't allow content to break outside\n\npre {\n display: block;\n margin-top: 0; // 1\n margin-bottom: 1rem; // 2\n overflow: auto; // 3\n @include font-size($code-font-size);\n color: $pre-color;\n\n // Account for some code outputs that place code tags in pre tags\n code {\n @include font-size(inherit);\n color: inherit;\n word-break: normal;\n }\n}\n\ncode {\n @include font-size($code-font-size);\n color: var(--#{$prefix}code-color);\n word-wrap: break-word;\n\n // Streamline the style when inside anchors to avoid broken underline and more\n a > & {\n color: inherit;\n }\n}\n\nkbd {\n padding: $kbd-padding-y $kbd-padding-x;\n @include font-size($kbd-font-size);\n color: $kbd-color;\n background-color: $kbd-bg;\n @include border-radius($border-radius-sm);\n\n kbd {\n padding: 0;\n @include font-size(1em);\n font-weight: $nested-kbd-font-weight;\n }\n}\n\n\n// Figures\n//\n// Apply a consistent margin strategy (matches our type styles).\n\nfigure {\n margin: 0 0 1rem;\n}\n\n\n// Images and content\n\nimg,\nsvg {\n vertical-align: middle;\n}\n\n\n// Tables\n//\n// Prevent double borders\n\ntable {\n caption-side: bottom;\n border-collapse: collapse;\n}\n\ncaption {\n padding-top: $table-cell-padding-y;\n padding-bottom: $table-cell-padding-y;\n color: $table-caption-color;\n text-align: left;\n}\n\n// 1. Removes font-weight bold by inheriting\n// 2. Matches default `