mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 11:32:38 +02:00
Docker: using Gunicorn (#55)
* docker: using gunicorn * cleanup Co-authored-by: CapsLock <github@legeox.net>
This commit is contained in:
parent
f5772d349a
commit
ff6bdb0f10
4 changed files with 38 additions and 7 deletions
|
@ -97,13 +97,17 @@ pip install -e .
|
|||
|
||||
### Running in docker
|
||||
|
||||
For this, you need to have [docker](https://docs.docker.com/engine/install/) and [docker-compose](https://docs.docker.com/compose/install/) installed.
|
||||
|
||||
To give a try to Copanier quickly, you can use docker:
|
||||
|
||||
```bash
|
||||
sudo docker build -t copanier:local .
|
||||
sudo docker run --name copanier --rm -p 2244:2244 copanier:local
|
||||
cd docker
|
||||
sudo docker-compose -p copanier up
|
||||
```
|
||||
|
||||
The app will be available at http://localhost:2244
|
||||
|
||||
## Run local server
|
||||
|
||||
Once everything is installed, you can use the `copanier` command to run the server.
|
||||
|
|
|
@ -12,9 +12,7 @@ ENV LANG fr_FR.UTF-8
|
|||
ENV LANGUAGE fr_FR:fr
|
||||
ENV LC_ALL fr_FR.UTF-8
|
||||
|
||||
RUN git clone https://github.com/spiral-project/copanier /srv/copanier
|
||||
RUN cd /srv/copanier/ && python3 -m venv venv && . ./venv/bin/activate && pip install wheel && pip install -e .
|
||||
COPY ./ /srv/copanier
|
||||
RUN cd /srv/copanier/ && python3 -m venv /srv/copanier-venv && . /srv/copanier-venv/bin/activate && pip install wheel gunicorn && pip install -e .
|
||||
|
||||
RUN dpkg-reconfigure locales
|
||||
RUN sed -i 's/simple_server(app, port=2244)/simple_server(app, host="0.0.0.0", port=2244)/g' /srv/copanier/copanier/__init__.py
|
||||
ENTRYPOINT ["/srv/copanier/venv/bin/copanier", "serve"]
|
||||
RUN dpkg-reconfigure locales
|
16
docker/docker-compose.yml
Normal file
16
docker/docker-compose.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
version: "3.9"
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: "./docker/Dockerfile"
|
||||
command: /srv/copanier-venv/bin/gunicorn -k roll.worker.Worker copanier:app --bind 0.0.0.0:2244
|
||||
static:
|
||||
image: "nginx:latest"
|
||||
volumes:
|
||||
- "../copanier/static:/srv/copanier_static/static:ro"
|
||||
- "./nginx-default.conf:/etc/nginx/conf.d/default.conf:ro"
|
||||
depends_on:
|
||||
- app
|
||||
ports:
|
||||
- 0.0.0.0:2244:80
|
13
docker/nginx-default.conf
Normal file
13
docker/nginx-default.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
proxy_pass http://app:2244;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
root /srv/copanier_static/;
|
||||
index index.html;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue