Added custom Dockerfiles for web and api services

master
Meliurwen 4 years ago
parent 06375f9b00
commit 0e1c6f987b
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 10
      api/Dockerfile
  2. 10
      api/enable_pjpeg.patch
  3. 26
      docker-compose.yml
  4. 15
      nginx/Dockerfile
  5. 13
      nginx/root/entrypoint.sh
  6. 0
      nginx/root/etc/nginx/conf.d/funkwhale.template
  7. 0
      nginx/root/etc/nginx/funkwhale_proxy.conf

@ -0,0 +1,10 @@
ARG IMAGE
ARG TAG
FROM ${IMAGE}:${TAG}
LABEL maintainer="Meliurwen <meliruwen@gmail.com>"
COPY enable_pjpeg.patch enable_pjpeg.patch
RUN patch -p1 < enable_pjpeg.patch

@ -0,0 +1,10 @@
--- api/config/settings/common.py.original 2020-08-29 12:29:47.397299670 +0200
+++ api/config/settings/common.py 2020-08-29 12:38:28.702664515 +0200
@@ -1228,6 +1228,7 @@
VERSATILEIMAGEFIELD_SETTINGS = {
"create_images_on_demand": False,
"jpeg_resize_quality": env.int("THUMBNAIL_JPEG_RESIZE_QUALITY", default=95),
+ "progressive_jpeg": True,
}
RSA_KEY_SIZE = 2048
# for performance gain in tests, since we don't need to actually create the

@ -56,7 +56,11 @@ services:
command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO
api:
image: funkwhale/funkwhale:${FUNKWHALE_VERSION:-latest}
build:
context: api/.
args:
- IMAGE=funkwhale/funkwhale
- TAG=${FUNKWHALE_VERSION:-latest}
container_name: ${AP_CONTAINER_NAME:-funkwhale-api}
restart: ${AP_RESTART:-unless-stopped}
networks:
@ -78,8 +82,12 @@ services:
environment:
- FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME}
nginx:
image: ${WB_IMG:-nginx}:${WB_TAG:-latest}
web:
build:
context: nginx/.
args:
- IMAGE=${WB_IMG:-nginx}
- TAG=${WB_TAG:-latest}
container_name: ${WB_CONTAINER_NAME:-funkwhale-web}
restart: ${WB_RESTART:-unless-stopped}
networks:
@ -88,8 +96,6 @@ services:
depends_on:
- api
volumes:
- "./nginx/funkwhale.template:/etc/nginx/conf.d/funkwhale.template:ro"
- "./nginx/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro"
- "${HOST_MUSIC_DIRECTORY_PATH}:/srv/wwww/music:ro"
- "${HOST_MEDIA_ROOT}:/srv/wwww/media:ro"
- "${HOST_STATIC_ROOT}:/srv/wwww/static:ro"
@ -100,16 +106,6 @@ services:
- nginx.env
environment:
- FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME}
- MEDIA_ROOT=/srv/wwww/media
- MUSIC_DIRECTORY_PATH=/srv/wwww/music
- STATIC_ROOT=/srv/wwww/static
- FUNKWHALE_FRONTEND_PATH=/srv/wwww/frontend
command: >
sh -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\"
< /etc/nginx/conf.d/funkwhale.template
> /etc/nginx/conf.d/default.conf
&& cat /etc/nginx/conf.d/default.conf
&& nginx -g 'daemon off;'"
networks:
default:

@ -0,0 +1,15 @@
ARG IMAGE
ARG TAG
FROM ${IMAGE}:${TAG}
LABEL maintainer="Meliurwen <meliruwen@gmail.com>"
COPY root/ /
ENV MEDIA_ROOT=/srv/wwww/media
ENV MUSIC_DIRECTORY_PATH=/srv/wwww/music
ENV STATIC_ROOT=/srv/wwww/static
ENV FUNKWHALE_FRONTEND_PATH=/srv/wwww/frontend
ENTRYPOINT ["/entrypoint.sh"]

@ -0,0 +1,13 @@
#!/bin/sh
# Exit at first error
set -e
# Fill the varibles in funkwhale.template and put the result in default.conf
envsubst "`env | awk -F = '{printf \" $$%s\", $$1}'`" < \
/etc/nginx/conf.d/funkwhale.template > \
/etc/nginx/conf.d/default.conf
cat /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'
Loading…
Cancel
Save