Skip to content

Commit

Permalink
Added Dockerfile and docker compose and nginx configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
nenad0707 committed May 25, 2024
1 parent 7c39109 commit cc03640
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 3 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Stage 1: Build the project
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src

COPY TaskTackler/TaskTackler.csproj TaskTackler/
RUN dotnet restore TaskTackler/TaskTackler.csproj
COPY . .
WORKDIR /src/TaskTackler
RUN dotnet build TaskTackler.csproj -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish TaskTackler.csproj -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

# Stage 2: Serve the app with Nginx
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
COPY --from=publish /app/publish/wwwroot .
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 80
2 changes: 1 addition & 1 deletion TaskTackler/Pages/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div class="wrapper">
<div class="logo">
<img src="images/task-logo.png" alt="Task Tackler logo">
<img src="Images/task-logo.png" alt="Task Tackler logo">
</div>
<div class="text-center mt-4 name">
Log in
Expand Down
2 changes: 1 addition & 1 deletion TaskTackler/Pages/Register.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="wrapper">
<div class="logo">
<img src="images/task-logo.png" alt="Task Tackler logo">
<img src="Images/task-logo.png" alt="Task Tackler logo">
</div>
<div class="text-center mt-4 name">
Sign up
Expand Down
1 change: 0 additions & 1 deletion TaskTackler/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<script src="_framework/blazor.webassembly.js"></script>
<script src="_content/Blazor.Bootstrap/blazor.bootstrap.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</body>

Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3.8"
services:
tasktacklerapp:
image: tasktacklerapp:latest
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:80"
environment:
- ApiUrl=http://localhost:7213/api/
19 changes: 19 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
events {}

http {
include mime.types;
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html =404;
}

location /Images/ {
root /usr/share/nginx/html;
autoindex on;
}
}
}

0 comments on commit cc03640

Please sign in to comment.