set docker
This commit is contained in:
29
docker/Dockerfile
Normal file
29
docker/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
FROM python:3.7
|
||||
|
||||
# Requirements
|
||||
ARG TIRAMISU_REPO_URL=https://framagit.org/tiramisu/tiramisu.git
|
||||
ARG RISOTTO_REPO_URL=https://forge.cadoles.com/Infra/risotto.git
|
||||
ARG ROUGAIL_REPO_URL=https://forge.cadoles.com/Infra/rougail.git
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
vim \
|
||||
curl \
|
||||
git \
|
||||
jq \
|
||||
&& apt-get clean
|
||||
|
||||
RUN git clone --branch develop ${TIRAMISU_REPO_URL} /srv/src/tiramisu
|
||||
RUN git clone --branch develop ${RISOTTO_REPO_URL} /srv/src/risotto
|
||||
RUN git clone --branch master ${ROUGAIL_REPO_URL} /srv/src/rougail
|
||||
|
||||
RUN ln -s /srv/src/tiramisu/tiramisu /usr/local/lib/python3.7
|
||||
RUN ln -s /srv/src/rougail/src/rougail /usr/local/lib/python3.7
|
||||
RUN ln -s /srv/src/risotto/src/risotto /usr/local/lib/python3.7
|
||||
|
||||
RUN pip install Cheetah3
|
||||
RUN cd /srv/src/risotto && pip install -r requirements.txt
|
||||
|
||||
# Installation
|
||||
RUN cp -r /srv/src/risotto/messages/ /usr/local/lib/
|
||||
RUN mkdir -p /var/cache/risotto/servermodel
|
||||
RUN mkdir /srv/src/risotto/database
|
15
docker/README.md
Normal file
15
docker/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
Docker
|
||||
```
|
||||
cd docker
|
||||
docker build -t cadoles/risotto .
|
||||
docker run -t -d --name risotto cadoles/risotto
|
||||
docker exec -ti risotto bash
|
||||
|
||||
```
|
||||
|
||||
Docker-Compose
|
||||
```
|
||||
cd docker
|
||||
docker-compose up
|
||||
docker-compose exec postgres /srv/src/postgres/postgres.init.sh
|
||||
```
|
22
docker/docker-compose.yaml
Normal file
22
docker/docker-compose.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
version: '2.2'
|
||||
services:
|
||||
risotto:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: docker/Dockerfile
|
||||
volumes:
|
||||
- .:/srv/src/risotto
|
||||
ports:
|
||||
- "8080:8080"
|
||||
restart: unless-stopped
|
||||
postgres:
|
||||
image: postgres:11-alpine
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
||||
PGDATA: /data/postgres
|
||||
volumes:
|
||||
- ./postgres-init:/srv/src/postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
restart: unless-stopped
|
9
docker/postgres-init/postgres.init.sh
Executable file
9
docker/postgres-init/postgres.init.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -h localhost <<-EOSQL
|
||||
CREATE ROLE risotto WITH LOGIN PASSWORD 'risotto';
|
||||
CREATE DATABASE risotto;
|
||||
GRANT ALL ON DATABASE risotto TO risotto;
|
||||
CREATE EXTENSION hstore;
|
||||
EOSQL
|
Reference in New Issue
Block a user