Docker is a stupid cunt
This commit is contained in:
parent
fd5d6b0f48
commit
4f62919434
@ -1,5 +1,9 @@
|
|||||||
BUILD_PATH=$1
|
BUILD_PATH=$1
|
||||||
|
|
||||||
|
cd $BUILD_PATH/src || exit 1
|
||||||
|
|
||||||
|
docker-build -f ./InternshipSystem.Api/Dockerfile -t internship.api .
|
||||||
|
|
||||||
cd $BUILD_PATH/.docker || exit 1
|
cd $BUILD_PATH/.docker || exit 1
|
||||||
|
|
||||||
docker-compose up -d --build --force-recreate
|
docker-compose up -d --force-recreate
|
@ -3,7 +3,6 @@ services:
|
|||||||
|
|
||||||
internship.api:
|
internship.api:
|
||||||
image: internship.api:latest
|
image: internship.api:latest
|
||||||
build: ../src/Internship.Api
|
|
||||||
ports:
|
ports:
|
||||||
- 8080:80
|
- 8080:80
|
||||||
|
|
||||||
|
73
.vscode/tasks.json
vendored
73
.vscode/tasks.json
vendored
@ -2,56 +2,48 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "build",
|
"label": "build: api",
|
||||||
"command": "dotnet",
|
"type": "docker-build",
|
||||||
"type": "process",
|
"dockerBuild": {
|
||||||
"args": [
|
"dockerfile": "src/InternshipSystem.Api/Dockerfile",
|
||||||
"build",
|
"tag": "internship.api",
|
||||||
"${workspaceFolder}/src/Internship.Api/Internship.Api.csproj",
|
"context": "src"
|
||||||
"/property:GenerateFullPaths=true",
|
},
|
||||||
"/consoleloggerparameters:NoSummary"
|
"problemMatcher": [],
|
||||||
],
|
"group": {
|
||||||
"problemMatcher": "$msCompile"
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "publish",
|
"label": "down: api",
|
||||||
"command": "dotnet",
|
"type": "shell",
|
||||||
"type": "process",
|
"command": "docker-compose",
|
||||||
"args": [
|
"args": [
|
||||||
"publish",
|
"-f",
|
||||||
"${workspaceFolder}/src/Internship.Api/Internship.Api.csproj",
|
".docker/docker-compose.yaml",
|
||||||
"/property:GenerateFullPaths=true",
|
"down",
|
||||||
"/consoleloggerparameters:NoSummary"
|
"--volumes"
|
||||||
],
|
]
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "watch",
|
"label": "up: api",
|
||||||
"command": "dotnet",
|
|
||||||
"type": "process",
|
|
||||||
"args": [
|
|
||||||
"watch",
|
|
||||||
"run",
|
|
||||||
"${workspaceFolder}/src/Internship.Api/Internship.Api.csproj",
|
|
||||||
"/property:GenerateFullPaths=true",
|
|
||||||
"/consoleloggerparameters:NoSummary"
|
|
||||||
],
|
|
||||||
"problemMatcher": "$msCompile"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "up",
|
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "docker-compose",
|
"command": "docker-compose",
|
||||||
"args": [
|
"args": [
|
||||||
"-f",
|
"-f",
|
||||||
".docker/docker-compose.yaml",
|
".docker/docker-compose.yaml",
|
||||||
"up",
|
"up",
|
||||||
"--build"
|
"--remove-orphans"
|
||||||
|
],
|
||||||
|
"dependsOn": [
|
||||||
|
"down: api",
|
||||||
|
"build: api"
|
||||||
],
|
],
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "dotnet restore",
|
"label": "restore",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "dotnet",
|
"command": "dotnet",
|
||||||
"args": [
|
"args": [
|
||||||
@ -59,5 +51,16 @@
|
|||||||
],
|
],
|
||||||
"problemMatcher": []
|
"problemMatcher": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "publish",
|
||||||
|
"command": "dotnet",
|
||||||
|
"args": [
|
||||||
|
"publish",
|
||||||
|
"--output",
|
||||||
|
"./obj/docker/publish",
|
||||||
|
"--runtime",
|
||||||
|
"linux-x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,24 +0,0 @@
|
|||||||
**/.classpath
|
|
||||||
**/.dockerignore
|
|
||||||
**/.env
|
|
||||||
**/.git
|
|
||||||
**/.gitignore
|
|
||||||
**/.project
|
|
||||||
**/.settings
|
|
||||||
**/.toolstarget
|
|
||||||
**/.vs
|
|
||||||
**/.vscode
|
|
||||||
**/*.*proj.user
|
|
||||||
**/*.dbmdl
|
|
||||||
**/*.jfm
|
|
||||||
**/azds.yaml
|
|
||||||
**/bin
|
|
||||||
**/charts
|
|
||||||
**/docker-compose*
|
|
||||||
**/Dockerfile*
|
|
||||||
**/node_modules
|
|
||||||
**/npm-debug.log
|
|
||||||
**/obj
|
|
||||||
**/secrets.dev.yaml
|
|
||||||
**/values.dev.yaml
|
|
||||||
README.md
|
|
@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using InternshipSystem.Core;
|
|
||||||
|
|
||||||
namespace InternshipSystem.Api.Controllers {
|
|
||||||
|
|
||||||
[ApiController]
|
|
||||||
//[Route("[internship]")]
|
|
||||||
public class InternshipController : ControllerBase {
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult GetInternships() {
|
|
||||||
//TODO: parse params
|
|
||||||
//return JsonResult("");
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public IActionResult CreateInternship(Internship internship) {
|
|
||||||
//TODO: add internship
|
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +1,19 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS prep-env
|
||||||
|
COPY . ./
|
||||||
|
RUN mkdir /proj && cp --parents */*.csproj /proj
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build-env
|
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build-env
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy csproj and restore as distinct layers
|
# Copy csproj and restore as distinct layers
|
||||||
COPY *.csproj ./
|
COPY --from=prep-env ./proj .
|
||||||
RUN dotnet restore
|
RUN dotnet restore ./InternshipSystem.Api
|
||||||
|
|
||||||
# Copy everything else and build
|
# Copy everything else and build
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN dotnet publish -c Release -o out
|
RUN dotnet publish ./InternshipSystem.Api -c Release -o out
|
||||||
|
|
||||||
# Build runtime image
|
# Build runtime image
|
||||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
|
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build-env /app/out .
|
COPY --from=build-env /app/out .
|
||||||
ENTRYPOINT ["dotnet", "./Internship.Api.dll"]
|
ENTRYPOINT ["dotnet", "./InternshipSystem.Api.dll"]
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\InternshipSystem.Core\InternshipSystem.Core.csproj" />
|
<ProjectReference Include="../InternshipSystem.Core/InternshipSystem.Core.csproj" />
|
||||||
|
<ProjectReference Include="../InternshipSystem.Repository/InternshipSystem.Repository.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -34,6 +34,7 @@ namespace InternshipSystem.Api
|
|||||||
.UseHttpsRedirection()
|
.UseHttpsRedirection()
|
||||||
.UseRouting()
|
.UseRouting()
|
||||||
.UseAuthorization()
|
.UseAuthorization()
|
||||||
|
.UseCors()
|
||||||
.UseEndpoints(endpoints =>
|
.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
endpoints.MapControllers();
|
endpoints.MapControllers();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="EFCore.NamingConventions" Version="1.1.0" />
|
<PackageReference Include="EFCore.NamingConventions" Version="1.1.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.4">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
Loading…
Reference in New Issue
Block a user