mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
create kestrel server for serving static files
This commit is contained in:
parent
a9b9094b9c
commit
71c4954ca8
@ -1,6 +1,5 @@
|
|||||||
FROM node
|
FROM bitwarden/server
|
||||||
|
|
||||||
RUN npm install http-server -g
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
http-server /etc/bitwarden/core/attachments/. -p 80 -d false --utc
|
dotnet /bitwarden_server/Server.dll /etc/bitwarden/core/attachments .
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26724.1
|
VisualStudioVersion = 15.0.26730.3
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -30,6 +30,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Identity", "src\Identity\Id
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Setup", "util\Setup\Setup.csproj", "{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Setup", "util\Setup\Setup.csproj", "{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "util\Server\Server.csproj", "{66B0A682-658A-4A82-B606-A077A4871448}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -66,6 +68,10 @@ Global
|
|||||||
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}.Release|Any CPU.Build.0 = Release|Any CPU
|
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{66B0A682-658A-4A82-B606-A077A4871448}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{66B0A682-658A-4A82-B606-A077A4871448}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{66B0A682-658A-4A82-B606-A077A4871448}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{66B0A682-658A-4A82-B606-A077A4871448}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -78,6 +84,7 @@ Global
|
|||||||
{02BC2982-ED8D-4A6D-A41E-092B3DAEB98A} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}
|
{02BC2982-ED8D-4A6D-A41E-092B3DAEB98A} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}
|
||||||
{04148736-3C0B-445E-8B74-2020E7A53502} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}
|
{04148736-3C0B-445E-8B74-2020E7A53502} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84D}
|
||||||
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84E}
|
{EF2164EF-1FC0-4518-A2ED-CE02D3630B00} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84E}
|
||||||
|
{66B0A682-658A-4A82-B606-A077A4871448} = {DD5BD056-4AAE-43EF-BBD2-0B569B8DA84E}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {E01CBF68-2E20-425F-9EDB-E0A6510CA92F}
|
SolutionGuid = {E01CBF68-2E20-425F-9EDB-E0A6510CA92F}
|
||||||
|
@ -4,6 +4,7 @@ echo $dir
|
|||||||
echo "`nBuilding bitwarden"
|
echo "`nBuilding bitwarden"
|
||||||
echo "=================="
|
echo "=================="
|
||||||
|
|
||||||
|
& $dir\util\Server\build.ps1
|
||||||
& $dir\src\Api\build.ps1
|
& $dir\src\Api\build.ps1
|
||||||
& $dir\src\Identity\build.ps1
|
& $dir\src\Identity\build.ps1
|
||||||
& $dir\nginx\build.ps1
|
& $dir\nginx\build.ps1
|
||||||
|
1
build.sh
1
build.sh
@ -6,6 +6,7 @@ DIR="$(dirname $(readlink -f $0))"
|
|||||||
echo -e "\nBuilding bitwarden"
|
echo -e "\nBuilding bitwarden"
|
||||||
echo -e "=================="
|
echo -e "=================="
|
||||||
|
|
||||||
|
$DIR/util/Server/build.sh
|
||||||
$DIR/src/Api/build.sh
|
$DIR/src/Api/build.sh
|
||||||
$DIR/src/Identity/build.sh
|
$DIR/src/Identity/build.sh
|
||||||
$DIR/nginx/build.sh
|
$DIR/nginx/build.sh
|
||||||
|
3
util/Server/.dockerignore
Normal file
3
util/Server/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!obj/Docker/publish/*
|
||||||
|
!obj/Docker/empty/
|
2
util/Server/Dockerfile
Normal file
2
util/Server/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FROM microsoft/aspnetcore:2.0
|
||||||
|
COPY obj/Docker/publish /bitwarden_server
|
27
util/Server/Program.cs
Normal file
27
util/Server/Program.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var builder = new WebHostBuilder()
|
||||||
|
.UseKestrel()
|
||||||
|
.UseStartup<Startup>();
|
||||||
|
|
||||||
|
if(args.Length > 0)
|
||||||
|
{
|
||||||
|
builder.UseContentRoot(args[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.Length > 1)
|
||||||
|
{
|
||||||
|
builder.UseWebRoot(args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var host = builder.Build();
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
util/Server/Properties/launchSettings.json
Normal file
12
util/Server/Properties/launchSettings.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"Server": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"applicationUrl": "http://localhost:53910/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
util/Server/Server.csproj
Normal file
12
util/Server/Server.csproj
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
16
util/Server/Startup.cs
Normal file
16
util/Server/Startup.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Server
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public void Configure(IApplicationBuilder app)
|
||||||
|
{
|
||||||
|
app.UseFileServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
util/Server/build.ps1
Normal file
11
util/Server/build.ps1
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
|
echo "`n# Building Server"
|
||||||
|
|
||||||
|
echo "`nBuilding app"
|
||||||
|
echo ".NET Core version $(dotnet --version)"
|
||||||
|
dotnet publish $dir\Server.csproj -c "Release" -o $dir\obj\Docker\publish
|
||||||
|
|
||||||
|
echo "`nBuilding docker image"
|
||||||
|
docker --version
|
||||||
|
docker build -t bitwarden/server $dir\.
|
14
util/Server/build.sh
Normal file
14
util/Server/build.sh
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DIR="$(dirname $(readlink -f $0))"
|
||||||
|
|
||||||
|
echo -e "\n# Building Server"
|
||||||
|
|
||||||
|
echo -e "\nBuilding app"
|
||||||
|
echo -e ".NET Core version $(dotnet --version)"
|
||||||
|
dotnet publish $DIR/Server.csproj -c "Release" -o $DIR/obj/Docker/publish
|
||||||
|
|
||||||
|
echo -e "\nBuilding docker image"
|
||||||
|
docker --version
|
||||||
|
docker build -t bitwarden/server $DIR/.
|
Loading…
Reference in New Issue
Block a user