From 4c897063062300eb00b9ac983720f7f67e0cd1ad Mon Sep 17 00:00:00 2001 From: Kaczanowski Mateusz Date: Wed, 4 Aug 2021 19:49:13 +0200 Subject: [PATCH] add docker-compose --- README.md | 6 +++++ docker-compose.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 07466b8..a84f22f 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,12 @@ ARM images: docker pull mkaczanowski/pastebin:armv7 docker pull mkaczanowski/pastebin:armv8 ``` + +Compose setup: +``` +URI="http://localhost" docker-compose up +curl -L "http://localhost" +``` ### Client ``` alias pastebin="curl -w '\n' -q -L --data-binary @- -o - http://localhost:8000/" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..48fe8ab --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,60 @@ +version: "3.7" + +services: + pastebin: + image: mkaczanowski/pastebin:latest + container_name: pastebin + volumes: + - $DOCKERDIR/pastebin:/var/lib/pastebin + restart: unless-stopped + command: --address 0.0.0.0 --port 8081 --uri ${URI} --db=/var/lib/pastebin/ + ports: + - "8081:8081" + volumes: + - ./db:/var/lib/pastebin/ + + nginx: + image: "nginx" + ports: + - "80:80" + links: + - pastebin:pastebin + command: | + bash -c "bash -s <<'EOF' + cat > /etc/nginx/nginx.conf <<'EON' + daemon off; + error_log /dev/stderr info; + + events { + worker_connections 768; + } + + http { + map $$sent_http_content_type $$expires { + default off; + text/css 30d; + application/javascript 30d; + image/x-icon 30d; + } + + server { + listen 80; + server_name 0.0.0.0; + + gzip on; + gzip_types text/plain application/xml text/css application/javascript; + + expires $$expires; + location / { + proxy_pass http://pastebin:8081; + + } + + access_log /dev/stdout; + } + } + EON + set -eux + cat /etc/nginx/nginx.conf + nginx + EOF"