Merge pull request 'Docker is a stupid cunt, fix dockerfile to work with project references' (#16) from fix/docker into master
This commit is contained in:
commit
d2c4bca9d5
@ -1,5 +1,9 @@
|
||||
BUILD_PATH=$1
|
||||
|
||||
cd $BUILD_PATH/src || exit 1
|
||||
|
||||
docker-build -f ./InternshipSystem.Api/Dockerfile -t internship.api .
|
||||
|
||||
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:
|
||||
image: internship.api:latest
|
||||
build: ../src/Internship.Api
|
||||
ports:
|
||||
- 8080:80
|
||||
|
||||
|
73
.vscode/tasks.json
vendored
73
.vscode/tasks.json
vendored
@ -2,56 +2,48 @@
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/src/Internship.Api/Internship.Api.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
"label": "build: api",
|
||||
"type": "docker-build",
|
||||
"dockerBuild": {
|
||||
"dockerfile": "src/InternshipSystem.Api/Dockerfile",
|
||||
"tag": "internship.api",
|
||||
"context": "src"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"label": "down: api",
|
||||
"type": "shell",
|
||||
"command": "docker-compose",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/src/Internship.Api/Internship.Api.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
"-f",
|
||||
".docker/docker-compose.yaml",
|
||||
"down",
|
||||
"--volumes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"${workspaceFolder}/src/Internship.Api/Internship.Api.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "up",
|
||||
"label": "up: api",
|
||||
"type": "shell",
|
||||
"command": "docker-compose",
|
||||
"args": [
|
||||
"-f",
|
||||
".docker/docker-compose.yaml",
|
||||
"up",
|
||||
"--build"
|
||||
"--remove-orphans"
|
||||
],
|
||||
"dependsOn": [
|
||||
"down: api",
|
||||
"build: api"
|
||||
],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "dotnet restore",
|
||||
"label": "restore",
|
||||
"type": "shell",
|
||||
"command": "dotnet",
|
||||
"args": [
|
||||
@ -59,5 +51,16 @@
|
||||
],
|
||||
"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
|
||||
WORKDIR /app
|
||||
|
||||
# Copy csproj and restore as distinct layers
|
||||
COPY *.csproj ./
|
||||
RUN dotnet restore
|
||||
COPY --from=prep-env ./proj .
|
||||
RUN dotnet restore ./InternshipSystem.Api
|
||||
|
||||
# Copy everything else and build
|
||||
COPY . ./
|
||||
RUN dotnet publish -c Release -o out
|
||||
RUN dotnet publish ./InternshipSystem.Api -c Release -o out
|
||||
|
||||
# Build runtime image
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/out .
|
||||
ENTRYPOINT ["dotnet", "./Internship.Api.dll"]
|
||||
ENTRYPOINT ["dotnet", "./InternshipSystem.Api.dll"]
|
||||
|
@ -18,7 +18,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InternshipSystem.Core\InternshipSystem.Core.csproj" />
|
||||
<ProjectReference Include="../InternshipSystem.Core/InternshipSystem.Core.csproj" />
|
||||
<ProjectReference Include="../InternshipSystem.Repository/InternshipSystem.Repository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -34,6 +34,7 @@ namespace InternshipSystem.Api
|
||||
.UseHttpsRedirection()
|
||||
.UseRouting()
|
||||
.UseAuthorization()
|
||||
.UseCors()
|
||||
.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<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>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
Loading…
Reference in New Issue
Block a user