Skip to content

Commit

Permalink
WIP: Provide a Docker Compose example
Browse files Browse the repository at this point in the history
Closes shaarli#1010

TODO:
- deploy on a VPS with an actual domain
- write a supporting deployment guide / article

See:
- https://hub.docker.com/r/jwilder/nginx-proxy/
- https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion/
- https://docs.docker.com/compose/environment-variables/

Signed-off-by: VirtualTam <[email protected]>
  • Loading branch information
virtualtam committed Jul 1, 2018
1 parent c429f28 commit 0f27195
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
.github
tests

# Docker Compose resources
docker-compose.env
docker-compose.yml

# Shaarli runtime resources
cache/*
data/*
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ doc/**/*.json export-ignore
doc/**/*.md export-ignore
.docker/ export-ignore
.dockerignore export-ignore
docker-compose.* export-ignore
Dockerfile* export-ignore
Doxyfile export-ignore
Makefile export-ignore
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SHAARLI_VIRTUAL_HOST=shaarli.local
SHAARLI_LETSENCRYPT_EMAIL=[email protected]
50 changes: 50 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
version: '3'

networks:
http-proxy:

volumes:
traefik-acme:
shaarli-data:

services:
shaarli:
image: shaarli/shaarli:master
build: ./
networks:
- http-proxy
volumes:
- shaarli-data:/var/www/shaarli/data
labels:
traefik.domain: "${SHAARLI_VIRTUAL_HOST}"
traefik.backend: shaarli
traefik.frontend.rule: "Host:${SHAARLI_VIRTUAL_HOST}"

traefik:
image: traefik
command:
- "/traefik"
- "--acme"
- "--acme.domain=${SHAARLI_VIRTUAL_HOST}"
- "--acme.email=${SHAARLI_LETSENCRYPT_EMAIL}"
- "--acme.entrypoint=https"
- "--acme.onhostrule=true"
- "--acme.storage=/acme/acme.json"
- "--acme.httpchallenge"
- "--acme.httpchallenge.entrypoint=http"
- "--docker"
- "--docker.domain=docker.localhost"
- "--docker.exposedbydefault=true"
- "--docker.watch=true"
- "--entrypoints='Name:http Address::80 Redirect.EntryPoint:https'"
- "--entrypoints='Name:https Address::443 TLS::'"
- "--retry"
networks:
- http-proxy
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- traefik-acme:/acme

0 comments on commit 0f27195

Please sign in to comment.