mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Add nginx container
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
FROM microsoft/aspnetcore:1.0.3
|
||||
|
||||
ARG PORT=56247
|
||||
ARG PUBLISH_DIR="bin/Publish"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV ASPNETCORE_URLS http://+:$PORT
|
||||
EXPOSE $PORT
|
||||
|
||||
COPY $PUBLISH_DIR .
|
||||
|
||||
RUN apt-get update && \
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Authentication;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -72,6 +73,12 @@ namespace Podsync
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
|
||||
// See https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction
|
||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||
});
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
@@ -6,12 +6,11 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
- PORT=80
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
- 5001
|
||||
environment:
|
||||
- ASPNETCORE_URLS=http://*:5001
|
||||
- Podsync:RedisConnectionString=redis
|
||||
env_file:
|
||||
- ~/podsync.env
|
||||
@@ -20,4 +19,11 @@ services:
|
||||
command: redis-server --appendonly yes
|
||||
restart: always
|
||||
volumes:
|
||||
- /data/redis:/data
|
||||
- /data/redis:/data
|
||||
nginx:
|
||||
image: nginx
|
||||
restart: always
|
||||
ports:
|
||||
- 80:80
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
14
src/Podsync/nginx.conf
Normal file
14
src/Podsync/nginx.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
gzip on;
|
||||
|
||||
location / {
|
||||
proxy_pass http://app:5001;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection keep-alive;
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
|
||||
"Microsoft.AspNetCore.Authentication.OAuth": "1.0.0",
|
||||
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
|
||||
"Microsoft.AspNetCore.HttpOverrides": "1.0.0",
|
||||
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
||||
"Microsoft.AspNetCore.Razor.Tools": {
|
||||
"version": "1.0.0-preview2-final",
|
||||
|
||||
Reference in New Issue
Block a user