[enh] better server with install.sh
This commit is contained in:
parent
42ccba832e
commit
9aa91985c9
4 changed files with 17 additions and 2 deletions
29
server/Dockerfile
Normal file
29
server/Dockerfile
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
FROM python:3.8-slim
|
||||
LABEL name=laser-app version=0.1
|
||||
|
||||
WORKDIR /opt
|
||||
RUN apt update
|
||||
RUN apt install -y --no-install-recommends build-essential\
|
||||
gcc\
|
||||
libagg2-dev\
|
||||
libpotrace-dev\
|
||||
nginx-light\
|
||||
pkg-config\
|
||||
python-dev\
|
||||
redis-server
|
||||
RUN rm -f /etc/nginx/sites-enabled/*
|
||||
RUN pip3 install flask numpy pillow redis
|
||||
RUN pip3 install pypotrace
|
||||
|
||||
COPY ./files/nginx/sites-enabled/site.conf /etc/nginx/sites-enabled
|
||||
COPY . .
|
||||
|
||||
COPY entrypoint.sh /usr/bin/
|
||||
RUN chmod +x /usr/bin/entrypoint.sh
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 5000
|
||||
EXPOSE 9001
|
||||
|
||||
# Start the main process.
|
||||
CMD ["python", "./server.py", "-i", "db"]
|
||||
43
server/docker-compose.yml
Normal file
43
server/docker-compose.yml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
version: '2'
|
||||
|
||||
volumes:
|
||||
laserrdb:
|
||||
external: true
|
||||
|
||||
services:
|
||||
|
||||
db:
|
||||
env_file: .env
|
||||
image: redis:6-alpine
|
||||
volumes:
|
||||
- laserrdb:/var/lib/redis
|
||||
command: ["redis-server", "--appendonly", "yes"]
|
||||
|
||||
|
||||
app:
|
||||
env_file: .env
|
||||
build: .
|
||||
image: teamlaser/laser-app:latest
|
||||
ports:
|
||||
- "5000:5000"
|
||||
depends_on:
|
||||
- db
|
||||
command: python ./server.py
|
||||
|
||||
assets:
|
||||
env_file: .env
|
||||
image: teamlaser/laser-app:latest
|
||||
ports:
|
||||
- "8080:80"
|
||||
depends_on:
|
||||
- app
|
||||
command: nginx -g 'daemon off;error_log /dev/stdout info;'
|
||||
|
||||
worker:
|
||||
env_file: .env
|
||||
build: .
|
||||
image: teamlaser/laser-app:latest
|
||||
depends_on:
|
||||
- db
|
||||
command: bash -c "while true; do python ./worker.py; sleep 3; done"
|
||||
|
||||
13
server/files/nginx/sites-enabled/site.conf
Normal file
13
server/files/nginx/sites-enabled/site.conf
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
server {
|
||||
server_name _;
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
root /opt/;
|
||||
location /image {
|
||||
proxy_pass http://app:5000;
|
||||
}
|
||||
# Docker specific conf
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
access_log /dev/stdout;
|
||||
|
||||
}
|
||||
17
server/install.sh
Normal file
17
server/install.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
apt update
|
||||
apt install -y --no-install-recommends build-essential\
|
||||
gcc\
|
||||
libagg2-dev\
|
||||
libpotrace-dev\
|
||||
nginx-light\
|
||||
pkg-config\
|
||||
python-dev\
|
||||
redis-server
|
||||
rm -f /etc/nginx/sites-enabled/*
|
||||
pip3 install flask numpy pillow redis
|
||||
pip3 install pypotrace
|
||||
cd /opt
|
||||
git clone https://git.interhacker.space/teamlaser/laser-app
|
||||
cp /opt/teamlaser/laser-app/files/nginx/sites-enabled/site.conf /etc/nginx/sites-enabled
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue