Merge dockerized into main
Reviewed-on: https://git.fsmi.org/paul/jon/pulls/6 Reviewed-by: Paul Brinkmeier <paul.brinkmeier@fsmi.uni-karlsruhe.de>
This commit is contained in:
commit
140b272f6c
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
FROM debian:latest as builder
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get upgrade -y
|
||||||
|
RUN apt-get install -y elm-compiler make ca-certificates
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
WORKDIR /app
|
||||||
|
RUN rm -rf .venv venv
|
||||||
|
|
||||||
|
RUN make frontend
|
||||||
|
|
||||||
|
|
||||||
|
FROM python:3.11-alpine as runner
|
||||||
|
COPY --from=builder /app /app
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
RUN pip install gunicorn
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
ENV JON_DB_CONNECTION_STRING="host=fsmi-db.fsmi.org dbname=garfield"
|
||||||
|
ENV JON_SECRET_KEY="changeme"
|
||||||
|
|
||||||
|
CMD ["sh", "-c", "gunicorn -b '0.0.0.0:5000' --chdir /app 'jon:create_app()'"]
|
14
README.md
14
README.md
@ -45,6 +45,20 @@ flask --app jon run --debug
|
|||||||
|
|
||||||
`--debug` restarts the server when a source file changes.
|
`--debug` restarts the server when a source file changes.
|
||||||
|
|
||||||
|
## Running with docker
|
||||||
|
When you prefer running the application using docker you can just use
|
||||||
|
```
|
||||||
|
docker compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
In case your local username does not line up with your FSMI-username, you need to specify your FSMI-username
|
||||||
|
using `USER=<username>`, e.g.:
|
||||||
|
```
|
||||||
|
USER=shirkanesi docker compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
This can also be persisted by following the instructions in the docker-compose.yml
|
||||||
|
|
||||||
## fsmi-db forward
|
## fsmi-db forward
|
||||||
|
|
||||||
```
|
```
|
||||||
|
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
jon:
|
||||||
|
container_name: jon
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
volumes:
|
||||||
|
- ~/.pgpass:/root/.pgpass:ro
|
||||||
|
dns:
|
||||||
|
- 1.1.1.1
|
||||||
|
- 8.8.8.8
|
||||||
|
network_mode: bridge
|
||||||
|
environment:
|
||||||
|
# If your local user is different from your fsmi user, change $USER here!
|
||||||
|
- JON_DB_CONNECTION_STRING="host=fsmi-db.fsmi.org dbname=garfield user=$USER"
|
||||||
|
- JON_SECRET_KEY="changemetosomethingsuperrandomandsecure"
|
@ -20,6 +20,7 @@ def create_app():
|
|||||||
# You don't need a config.json. If you don't provide one, default-config.json
|
# You don't need a config.json. If you don't provide one, default-config.json
|
||||||
# is used.
|
# is used.
|
||||||
app.config.from_file("config.json", load=json.load, silent=True)
|
app.config.from_file("config.json", load=json.load, silent=True)
|
||||||
|
app.config.from_prefixed_env(prefix="JON")
|
||||||
|
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
auth.init_app(app)
|
auth.init_app(app)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user