diff options
author | VirtualTam <virtualtam@flibidi.net> | 2018-06-27 01:20:22 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2018-07-12 21:48:48 +0200 |
commit | 81c801300b2912dc19a24314629ee550b1899d34 (patch) | |
tree | 85a23d3abd7c3fa6f31821a8c1d9dcdfe8c9487e | |
parent | c9fcaaee931cca31e66ff594905e18e23a9f05ae (diff) | |
download | Shaarli-81c801300b2912dc19a24314629ee550b1899d34.tar.gz Shaarli-81c801300b2912dc19a24314629ee550b1899d34.tar.zst Shaarli-81c801300b2912dc19a24314629ee550b1899d34.zip |
Provide a Docker Compose example
Closes https://github.com/shaarli/Shaarli/issues/1010
See:
- https://hub.docker.com/_/traefik/
- https://docs.traefik.io/configuration/backends/docker/
- https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
- https://github.com/containous/traefik/pull/2798
- https://github.com/containous/traefik/issues/3298
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
-rw-r--r-- | .dockerignore | 3 | ||||
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | docker-compose.yml | 56 |
3 files changed, 60 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore index a0d28dc6..96fd31c5 100644 --- a/.dockerignore +++ b/.dockerignore | |||
@@ -4,6 +4,9 @@ | |||
4 | .github | 4 | .github |
5 | tests | 5 | tests |
6 | 6 | ||
7 | # Docker Compose resources | ||
8 | docker-compose.yml | ||
9 | |||
7 | # Shaarli runtime resources | 10 | # Shaarli runtime resources |
8 | cache/* | 11 | cache/* |
9 | data/* | 12 | data/* |
diff --git a/.gitattributes b/.gitattributes index 9d22f11b..9a92bc37 100644 --- a/.gitattributes +++ b/.gitattributes | |||
@@ -35,6 +35,7 @@ doc/**/*.json export-ignore | |||
35 | doc/**/*.md export-ignore | 35 | doc/**/*.md export-ignore |
36 | .docker/ export-ignore | 36 | .docker/ export-ignore |
37 | .dockerignore export-ignore | 37 | .dockerignore export-ignore |
38 | docker-compose.* export-ignore | ||
38 | Dockerfile* export-ignore | 39 | Dockerfile* export-ignore |
39 | Doxyfile export-ignore | 40 | Doxyfile export-ignore |
40 | Makefile export-ignore | 41 | Makefile export-ignore |
diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..fc68bf30 --- /dev/null +++ b/docker-compose.yml | |||
@@ -0,0 +1,56 @@ | |||
1 | --- | ||
2 | # Shaarli - Docker Compose script | ||
3 | # | ||
4 | # See: | ||
5 | # - https://shaarli.readthedocs.io/en/master/docker/shaarli-images/ | ||
6 | version: '3' | ||
7 | |||
8 | networks: | ||
9 | http-proxy: | ||
10 | |||
11 | volumes: | ||
12 | traefik-acme: | ||
13 | shaarli-cache: | ||
14 | shaarli-data: | ||
15 | |||
16 | services: | ||
17 | shaarli: | ||
18 | image: shaarli/shaarli:master | ||
19 | build: ./ | ||
20 | networks: | ||
21 | - http-proxy | ||
22 | volumes: | ||
23 | - shaarli-cache:/var/www/shaarli/cache | ||
24 | - shaarli-data:/var/www/shaarli/data | ||
25 | labels: | ||
26 | traefik.domain: "${SHAARLI_VIRTUAL_HOST}" | ||
27 | traefik.backend: shaarli | ||
28 | traefik.frontend.rule: "Host:${SHAARLI_VIRTUAL_HOST}" | ||
29 | |||
30 | traefik: | ||
31 | image: traefik | ||
32 | command: | ||
33 | - "--defaultentrypoints=http,https" | ||
34 | - "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https" | ||
35 | - "--entrypoints=Name:https Address::443 TLS" | ||
36 | - "--retry" | ||
37 | - "--docker" | ||
38 | - "--docker.domain=docker.localhost" | ||
39 | - "--docker.exposedbydefault=true" | ||
40 | - "--docker.watch=true" | ||
41 | - "--acme" | ||
42 | - "--acme.domains=${SHAARLI_VIRTUAL_HOST}" | ||
43 | - "--acme.email=${SHAARLI_LETSENCRYPT_EMAIL}" | ||
44 | - "--acme.entrypoint=https" | ||
45 | - "--acme.onhostrule=true" | ||
46 | - "--acme.storage=/acme/acme.json" | ||
47 | - "--acme.httpchallenge" | ||
48 | - "--acme.httpchallenge.entrypoint=http" | ||
49 | networks: | ||
50 | - http-proxy | ||
51 | ports: | ||
52 | - 80:80 | ||
53 | - 443:443 | ||
54 | volumes: | ||
55 | - /var/run/docker.sock:/var/run/docker.sock:ro | ||
56 | - traefik-acme:/acme | ||