add docker-compose

This commit is contained in:
Kaczanowski Mateusz 2021-08-04 19:49:13 +02:00
parent c5752a0a6b
commit 4c89706306
2 changed files with 66 additions and 0 deletions

View file

@ -77,6 +77,12 @@ ARM images:
docker pull mkaczanowski/pastebin:armv7 docker pull mkaczanowski/pastebin:armv7
docker pull mkaczanowski/pastebin:armv8 docker pull mkaczanowski/pastebin:armv8
``` ```
Compose setup:
```
URI="http://localhost" docker-compose up
curl -L "http://localhost"
```
### Client ### Client
``` ```
alias pastebin="curl -w '\n' -q -L --data-binary @- -o - http://localhost:8000/" alias pastebin="curl -w '\n' -q -L --data-binary @- -o - http://localhost:8000/"

60
docker-compose.yml Normal file
View file

@ -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"