diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..9cab97b11 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Set default behavior to automatically normalize line endings. +* text=auto + +# Always convert bash script line endings to LF on checkout. +*.sh text eol=lf \ No newline at end of file diff --git a/AllReadyApp/.dockerignore b/AllReadyApp/.dockerignore new file mode 100644 index 000000000..2171c0476 --- /dev/null +++ b/AllReadyApp/.dockerignore @@ -0,0 +1,12 @@ +.dockerignore +.env +.git +.gitignore +.vs +.vscode +docker-compose.yml +docker-compose.*.yml +*/bin +*/obj +!obj/Docker/publish/* +!obj/Docker/empty/ \ No newline at end of file diff --git a/AllReadyApp/.vscode/launch.json b/AllReadyApp/.vscode/launch.json new file mode 100644 index 000000000..606a3adeb --- /dev/null +++ b/AllReadyApp/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug in Docker", + "type": "coreclr", + "request": "launch", + "program": "/app/Web-App/AllReady/bin/Debug/netcoreapp2.0/AllReady.dll", + "cwd": "/app/Web-App/AllReady", + "sourceFileMap": { + "/app": "${workspaceRoot}" + }, + "pipeTransport": { + "pipeProgram": "docker", + "pipeCwd": "${workspaceRoot}", + "pipeArgs": [ + "exec -i allreadyweb" + ], + "quoteArgs": false, + "debuggerPath": "/root/vsdbg/vsdbg" + } + } + ] +} \ No newline at end of file diff --git a/AllReadyApp/Web-App/AllReady/Dockerfile b/AllReadyApp/Web-App/AllReady/Dockerfile new file mode 100644 index 000000000..6311b8662 --- /dev/null +++ b/AllReadyApp/Web-App/AllReady/Dockerfile @@ -0,0 +1,30 @@ +FROM microsoft/aspnetcore-build:2.0 + +#Install debugger +RUN apt-get update +RUN apt-get install curl -y unzip +RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg + +# Install npm packages +WORKDIR /app/Web-App/AllReady +COPY Web-App/AllReady/package.json . +COPY Web-App/AllReady/package-lock.json . +RUN ["npm", "install"] + +# Run dotnet restore +WORKDIR /app +COPY *.sln ./ +COPY Web-App/AllReady/AllReady.csproj Web-App/AllReady/ +COPY AllReady.Core/AllReady.Core.csproj AllReady.Core/ +RUN dotnet restore AllReadyWebOnly.sln +COPY . . +WORKDIR /app/Web-App/AllReady + +# Build project +RUN ["dotnet","build"] + +# Run gulp tasks +RUN gulp clean && gulp min +EXPOSE 80/tcp +RUN chmod +x ../../entrypoint.sh +CMD /bin/bash ../../entrypoint.sh \ No newline at end of file diff --git a/AllReadyApp/Web-App/AllReady/Dockerfile.debug b/AllReadyApp/Web-App/AllReady/Dockerfile.debug new file mode 100644 index 000000000..c53d43aaa --- /dev/null +++ b/AllReadyApp/Web-App/AllReady/Dockerfile.debug @@ -0,0 +1,12 @@ +FROM microsoft/aspnetcore-build:2.0 +RUN mkdir app + +#Install debugger +RUN apt-get update +RUN apt-get install curl -y unzip +RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg + +EXPOSE 80/tcp + +#Keep the debugger container on +ENTRYPOINT ["tail", "-f", "/dev/null"] \ No newline at end of file diff --git a/AllReadyApp/Web-App/AllReady/Startup.cs b/AllReadyApp/Web-App/AllReady/Startup.cs index c4b8766de..b793ec0ad 100644 --- a/AllReadyApp/Web-App/AllReady/Startup.cs +++ b/AllReadyApp/Web-App/AllReady/Startup.cs @@ -169,7 +169,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services) //Hangfire services.AddHangfire(configuration => configuration.UseSqlServerStorage(Configuration["Data:HangfireConnection:ConnectionString"])); - + services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -184,7 +184,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, AllReady { // Put first to avoid issues with OPTIONS when calling from Angular/Browser. app.UseCors("allReady"); - app.UseSession(); // Add the following to the request pipeline only in development environment. diff --git a/AllReadyApp/Web-App/AllReady/appsettings.json b/AllReadyApp/Web-App/AllReady/appsettings.json index 97f084d92..5660e86b2 100644 --- a/AllReadyApp/Web-App/AllReady/appsettings.json +++ b/AllReadyApp/Web-App/AllReady/appsettings.json @@ -33,7 +33,7 @@ }, "Data": { "DefaultConnection": { - "ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=AllReady;Integrated Security=true;MultipleActiveResultsets=true;" + "ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=AllReady;Integrated Security=true;MultipleActiveResultsets=true;" }, "HangfireConnection": { "ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=AllReady;Integrated Security=true;MultipleActiveResultsets=true;" diff --git a/AllReadyApp/docker-compose.yml b/AllReadyApp/docker-compose.yml new file mode 100644 index 000000000..80356d06a --- /dev/null +++ b/AllReadyApp/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3" +services: + web: + build: + context: . + dockerfile: Web-App/AllReady/Dockerfile + container_name: allreadyweb + environment: + ASPNETCORE_ENVIRONMENT: Development + Data__DefaultConnection__ConnectionString: "Server=db,1433;Initial Catalog=master;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;" + Data__HangfireConnection__ConnectionString: "Server=db,1433;Initial Catalog=master;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;" + ports: + - "8000:80" + depends_on: + - db + db: + image: "microsoft/mssql-server-linux:2017-CU3" + container_name: allreadysqlserver + volumes: + - sql-server-data:/var/opt/mssql + ports: + - "1433:1433" + environment: + SA_PASSWORD: "yourStrong(!)Password" + ACCEPT_EULA: "Y" + +volumes: + sql-server-data: \ No newline at end of file diff --git a/AllReadyApp/entrypoint.sh b/AllReadyApp/entrypoint.sh new file mode 100644 index 000000000..1a0d33b03 --- /dev/null +++ b/AllReadyApp/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e +run_cmd="tail -f /dev/null" +until dotnet ef database update; do +>&2 echo "SQL Server is starting up" +sleep 1 +done + +>&2 echo "App and SQL Server is running" +exec $run_cmd \ No newline at end of file