├── .editorconfig ├── .travis.yml ├── Caddyfile ├── Dockerfile ├── LICENSE ├── README.md └── renovate.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sudo: required 3 | 4 | services: 5 | - docker 6 | 7 | env: 8 | - VERSION=0.10.12 9 | 10 | install: 11 | - docker build -t "lgatica/django-caddy:$VERSION" -t lgatica/django-caddy:latest . 12 | 13 | script: 14 | - docker run --rm "lgatica/django-caddy:$VERSION" --version 15 | 16 | before_deploy: 17 | - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" 18 | 19 | deploy: 20 | provider: script 21 | script: docker push "lgatica/django-caddy:$VERSION" && docker push lgatica/django-caddy:latest 22 | skip_cleanup: true 23 | on: 24 | branch: master 25 | -------------------------------------------------------------------------------- /Caddyfile: -------------------------------------------------------------------------------- 1 | 0.0.0.0:80 2 | { 3 | proxy / django:{$PORT} { 4 | transparent 5 | except /media /static 6 | } 7 | 8 | root /var/www 9 | 10 | log /var/log/access.log { 11 | rotate_size 100 # Rotate after 100 MB 12 | rotate_age 14 # Keep log files for 14 days 13 | rotate_keep 10 # Keep at most 10 log files 14 | rotate_compress # Compress rotated log files in gzip format 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7@sha256:92251458088c638061cda8fd8b403b76d661a4dc6b7ee71b6affcf1872557b2b 2 | 3 | LABEL maintainer="Leonardo Gatica " \ 4 | caddy_version="0.10.12" \ 5 | architecture="amd64" 6 | 7 | ENV PORT=8000 CADDY_VERSION=0.10.12 CADDY_ARCHITECTURE=amd64 8 | 9 | RUN apk add --no-cache openssh-client git tar curl 10 | 11 | RUN curl --silent --show-error --fail --location \ 12 | --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ 13 | "https://github.com/mholt/caddy/releases/download/v${CADDY_VERSION}/caddy_v${CADDY_VERSION}_linux_${CADDY_ARCHITECTURE}.tar.gz" \ 14 | | tar --no-same-owner -C /usr/bin -xz \ 15 | && chmod 0755 /usr/bin/caddy \ 16 | && /usr/bin/caddy -version 17 | 18 | EXPOSE 80 443 2015 19 | VOLUME /root/.caddy 20 | WORKDIR /srv 21 | 22 | COPY Caddyfile /etc/Caddyfile 23 | 24 | ENTRYPOINT ["/usr/bin/caddy"] 25 | CMD ["--conf", "/etc/Caddyfile", "--log", "stdout"] 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Leonardo Gatica 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # django-caddy 2 | 3 | [![dockeri.co](http://dockeri.co/image/lgatica/django-caddy)](https://hub.docker.com/r/lgatica/django-caddy/) 4 | 5 | [![Build Status](https://travis-ci.org/lgaticaq/django-caddy.svg?branch=master)](https://travis-ci.org/lgaticaq/django-caddy) 6 | 7 | > Docker Image for reverse proxy django apps with caddyserver and alpine linux 8 | 9 | Supported tags and respective Dockerfile links 10 | 11 | - 0.10.12, latest ([Dockerfile](https://github.com/lgaticaq/django-caddy/blob/master/Dockerfile)) 12 | 13 | ## Instructions 14 | 15 | ```bash 16 | docker create volume --name static 17 | docker create volume --name media 18 | docker create volume --name logs 19 | docker run -d --name django -v static:/path/to/static -v media:/path/to/media -e PORT 8000 your-django-image-with-gunicorn 20 | docker run -d --name caddy --link django:django -v static:/var/www/static -v media:/var/www/media -v logs:/var/log -e PORT 8000 lgatica/django-caddy 21 | ``` 22 | 23 | docker-compose.yml 24 | ```yml 25 | version: '2' 26 | services: 27 | django: 28 | image: your-django-image-with-gunicorn 29 | environment: 30 | - PORT=8000 31 | volumes: 32 | - static:/path/to/static 33 | - media:/path/to/media 34 | caddy: 35 | image: lgatica/django-caddy:latest 36 | links: 37 | - django:django 38 | environment: 39 | - PORT=8000 40 | ports: 41 | - 80:80 42 | volumes: 43 | - static:/var/www/static 44 | - media:/var/www/media 45 | - logs:/var/log 46 | volumes: 47 | static: 48 | media: 49 | logs: 50 | ``` 51 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base", ":docker", "default:automergeDigest"] 3 | } 4 | --------------------------------------------------------------------------------