Skip to content

Commit

Permalink
Merge pull request #63 from AleksanderNekr/develop
Browse files Browse the repository at this point in the history
Alpha release
  • Loading branch information
AleksanderNekr authored Mar 22, 2024
2 parents 751a998 + a59f038 commit 931f8ff
Show file tree
Hide file tree
Showing 169 changed files with 18,665 additions and 50 deletions.
35 changes: 35 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.next
**/.cache
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/build
**/dist
LICENSE
README.md
**/.DS_Store
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
bin
obj
obj
data
11 changes: 10 additions & 1 deletion LichessAnalyzer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{23C1B930-0866-4F73-8F4B-9E0FE2D523DD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi", "src\WebApi\WebApi.csproj", "{D611F60A-97F0-4D8D-8939-5195BDA1AFF5}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backend", "src\Backend\Backend.csproj", "{D611F60A-97F0-4D8D-8939-5195BDA1AFF5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E7C2A87A-281D-4CC1-A28F-4B90A3D74177}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackendTests", "tests\BackendTests\BackendTests.csproj", "{7058DF6D-661A-483F-9EBF-160258516129}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -20,8 +24,13 @@ Global
{D611F60A-97F0-4D8D-8939-5195BDA1AFF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D611F60A-97F0-4D8D-8939-5195BDA1AFF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D611F60A-97F0-4D8D-8939-5195BDA1AFF5}.Release|Any CPU.Build.0 = Release|Any CPU
{7058DF6D-661A-483F-9EBF-160258516129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7058DF6D-661A-483F-9EBF-160258516129}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7058DF6D-661A-483F-9EBF-160258516129}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7058DF6D-661A-483F-9EBF-160258516129}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D611F60A-97F0-4D8D-8939-5195BDA1AFF5} = {23C1B930-0866-4F73-8F4B-9E0FE2D523DD}
{7058DF6D-661A-483F-9EBF-160258516129} = {E7C2A87A-281D-4CC1-A28F-4B90A3D74177}
EndGlobalSection
EndGlobal
24 changes: 24 additions & 0 deletions README.Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Building and running your application

When you're ready, start your application by running:
`docker compose up --build`.

Your application will be available at http://localhost:8080.

### Deploying your application to the cloud

First, build your image, e.g.: `docker build -t myapp .`.
If your cloud uses a different CPU architecture than your development
machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
you'll want to build the image for that platform, e.g.:
`docker build --platform=linux/amd64 -t myapp .`.

Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.

Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
docs for more detail on building and pushing.

### References
* [Docker's .NET guide](https://docs.docker.com/language/dotnet/)
* The [dotnet-docker](https://github.com/dotnet/dotnet-docker/tree/main/samples)
repository has many relevant samples and docs.
28 changes: 28 additions & 0 deletions cc-back.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS prepare-restore-files
ENV PATH="${PATH}:/root/.dotnet/tools"
RUN dotnet tool install --global --no-cache dotnet-subset --version 0.3.2
WORKDIR /app/src/
COPY . .
RUN dotnet subset restore "src/Backend/Backend.csproj" --root-directory /app/src --output restore_subset/

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app/src
COPY --from=prepare-restore-files app/src/restore_subset .
RUN dotnet restore "src/Backend/Backend.csproj"
COPY . .
RUN dotnet build "src/Backend/Backend.csproj" -c Release -o /app/build
# For healthchecks
RUN apt-get update && apt-get install -y curl

FROM build AS publish
RUN dotnet publish "src/Backend/Backend.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Backend.dll"]
16 changes: 16 additions & 0 deletions cc-front.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# syntax=docker/dockerfile:1
FROM node:20-alpine as angular
WORKDIR /ng-app
COPY src/Frontend/package*.json ./
RUN npm install -g npm@10.5.0
RUN npm ci --legacy-peer-deps
COPY ./src/Frontend/ ./
RUN npm run build

FROM nginx:alpine
COPY ./nginx-cc.conf /etc/nginx/conf.d/
RUN rm /etc/nginx/conf.d/default.conf
RUN mv /etc/nginx/conf.d/nginx-cc.conf /etc/nginx/conf.d/default.conf

COPY --from=angular /ng-app/dist/frontend/browser /usr/share/nginx/html
EXPOSE 8080
52 changes: 52 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
services:
front:
container_name: front
build:
context: ./src/Frontend/
environment:
NODE_ENV: production
ports:
- 4200:4200
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
server:
container_name: back
build:
context: ./src/Backend/
target: final
ports:
- 8080:8080
depends_on:
front:
condition: service_started
postgres:
image: postgres
restart: unless-stopped
environment:
DATABASE_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- "5432:5432"
volumes:
- ./data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
redis:
container_name: redis
image: redis:alpine
ports:
- "6379:6379"
command: >
redis-server --bind redis
--requirepass redispass
--maxmemory 30mb
--maxmemory-policy allkeys-lru
--appendonly yes
16 changes: 16 additions & 0 deletions nginx-cc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
listen 8080;
server_name localhost;

root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
32 changes: 32 additions & 0 deletions src/Backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
Loading

0 comments on commit 931f8ff

Please sign in to comment.