static(major): switch to pixie for static files

This commit is contained in:
Langhammer, Jens 2019-11-19 18:00:29 +01:00
parent 089b48aad1
commit 49a347b32f
5 changed files with 5 additions and 74 deletions

View File

@ -68,7 +68,7 @@ services:
- internal
labels:
- traefik.frontend.rule=PathPrefix:/static, /robots.txt
- traefik.port=80
- traefik.port=8080
- traefik.docker.network=internal
traefik:
image: traefik:1.7

View File

@ -1,66 +0,0 @@
user nginx;
worker_processes 1;
error_log stderr warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format json_combined escape=json
'{'
'"time_local":"$time_local",'
'"remote_addr":"$remote_addr",'
'"remote_user":"$remote_user",'
'"request":"$request",'
'"status": "$status",'
'"body_bytes_sent":"$body_bytes_sent",'
'"request_time":"$request_time",'
'"http_referrer":"$http_referer",'
'"http_user_agent":"$http_user_agent"'
'}';
access_log /dev/stdout json_combined;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
server {
server_name _;
gzip on;
gzip_types application/javascript image/* text/css;
gunzip on;
add_header X-passbook-Version 0.7.2-beta;
add_header Vary X-passbook-Version;
root /data/;
location /_/healthz {
return 204;
}
location ~* \.(jpg|jpeg|png|gif|ico)$ {
expires 30d;
}
location ~* \.(css|js)$ {
expires 7d;
}
}
server {
listen 8080;
location = /stub_status {
stub_status;
}
}
}

View File

@ -25,7 +25,7 @@ spec:
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
containerPort: 8080
protocol: TCP
livenessProbe:
initialDelaySeconds: 10
@ -46,6 +46,3 @@ spec:
limits:
cpu: 20m
memory: 20M
- name: {{ .Chart.Name }}-static-prometheus
image: nginx/nginx-prometheus-exporter:0.4.1
imagePullPolicy: IfNotPresent

View File

@ -11,7 +11,7 @@ metadata:
spec:
type: ClusterIP
ports:
- port: 80
- port: 8080
targetPort: http
protocol: TCP
name: http

View File

@ -10,8 +10,8 @@ ENV PASSBOOK_POSTGRESQL__USER=passbook
ENV PASSBOOK_POSTGRESQL__PASSWORD="EK-5jnKfjrGRm<77"
RUN ./manage.py collectstatic --no-input
FROM nginx:latest
FROM docker.beryju.org/pixie/server
COPY --from=static-build /app/static /data/static/
COPY --from=static-build /app/static/robots.txt /data/robots.txt
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
WORKDIR /data