Skip to content

Commit

Permalink
feat: Add Docker containers for Web Frontend and Web Backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukash88 committed Nov 10, 2023
1 parent 7ef4f57 commit 0f6703b
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/env_issue_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Environment Issue
about: Use this template to report problem with environment setting or installation
title: 'Environment: here describe what's wrong shortly'
title: "Environment: here describe what's wrong shortly"
assignees: Strayker
---

Expand Down
13 changes: 13 additions & 0 deletions binder-web-backend/Binder.Api/appsettings.Docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;Database=binder_db;User Id=newuser;Pwd=example;"
},
"FrontendUrl": "http://localhost:4200",
"BackendUrl": "http://localhost:5246"
}
25 changes: 25 additions & 0 deletions binder-web-backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
EXPOSE 80

COPY binder-web-backend/Binder.sln binder-web-backend/Binder.sln
COPY binder-web-backend/Binder.Api/Binder.Api.csproj binder-web-backend/Binder.Api/Binder.Api.csproj
COPY binder-web-backend/Binder.Application/Binder.Application.csproj binder-web-backend/Binder.Application/Binder.Application.csproj
COPY binder-web-backend/Binder.Core/Binder.Core.csproj binder-web-backend/Binder.Core/Binder.Core.csproj
COPY binder-web-backend/Binder.IntegrationTests/Binder.IntegrationTests.csproj binder-web-backend/Binder.IntegrationTests/Binder.IntegrationTests.csproj
COPY binder-web-backend/Binder.Persistence/Binder.Persistence.csproj binder-web-backend/Binder.Persistence/Binder.Persistence.csproj
COPY binder-web-backend/Binder.UnitTests/Binder.UnitTests.csproj binder-web-backend/Binder.UnitTests/Binder.UnitTests.csproj

RUN dotnet restore binder-web-backend/Binder.sln

COPY binder-web-backend/Binder.Api binder-web-backend/Binder.Api
COPY binder-web-backend/Binder.Application binder-web-backend/Binder.Application
COPY binder-web-backend/Binder.Persistence binder-web-backend/Binder.Persistence
COPY binder-web-backend/Binder.Core binder-web-backend/Binder.Core
WORKDIR /app/binder-web-backend
RUN dotnet publish -c Release -o /app/binder-web-backend/out

FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build /app/binder-web-backend/out .
ENTRYPOINT [ "dotnet", "Binder.Api.dll" ]
15 changes: 15 additions & 0 deletions binder-web-frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:18.10.0 as builder
WORKDIR /app

COPY package.json package-lock.json ./

RUN npm install
RUN npm run prepare-husky

COPY . .

EXPOSE 4200

ENV PORT 4200

CMD ["npm", "run", "dev"]
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3.7'
services:
database:
image: mysql:5.7
restart: 'always'
environment:
MYSQL_ROOT_PASSWORD: 'Root0++'
MYSQL_USER: 'newuser'
MYSQL_ROOT_HOST: 'localhost'
MYSQL_PASSWORD: 'pass@word1234'
MYSQL_DATABASE: 'binder_db'
ports:
- '3306:3306'

api:
build:
context: .
dockerfile: binder-web-backend/Dockerfile
depends_on:
- database
ports:
- '5246:80'
restart: always
environment:
DBHOST: database
ASPNETCORE_ENVIRONMENT: Docker
ASPNETCORE_URLS: http://+:80
ConnectionStrings__DefaultConnection: 'Server=database;Port=3306;Database=binder_db;User Id=newuser;Pwd=pass@word1234;'

angular-app:
build:
context: binder-web-frontend/.
dockerfile: Dockerfile
ports:
- '4200:4200'

0 comments on commit 0f6703b

Please sign in to comment.