dockerize
This commit is contained in:
parent
ee6f35b771
commit
26994d4536
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
FROM python:3.12-bookworm
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt install dumb-init
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
EXPOSE 8000
|
||||
EXPOSE 8001
|
||||
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
14
README.md
14
README.md
@ -29,3 +29,17 @@ Use `pip install -r requirements.txt` to install the requirements. The usage of
|
||||
### Step 4: Running the application
|
||||
|
||||
Run the application by executing the file `EzLanManager.py` found at `src/ez_lan_manager`. Check the STDOUT for information regarding the port on which the application is now served.
|
||||
|
||||
## Docker Deployment
|
||||
|
||||
To get the docker compose setup running, you need to manually complete the following steps:
|
||||
|
||||
1. Create a valid `config.toml` in the project root, so it gets copied over into the container.
|
||||
2. Create the database user:
|
||||
```sql
|
||||
CREATE USER 'ez_lan_manager'@'%' IDENTIFIED BY 'PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON ez_lan_manager.* TO 'ez_lan_manager'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
3. Make sure to **NOT** use the default passwords!
|
||||
4. Apply the `create_database.sql` when starting the MariaDB container for the first time.
|
||||
|
||||
36
docker-compose.yml
Normal file
36
docker-compose.yml
Normal file
@ -0,0 +1,36 @@
|
||||
services:
|
||||
lan_manager:
|
||||
build: .
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
PYTHONPATH: /opt/ez-lan-manager
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "8001:8001"
|
||||
volumes:
|
||||
- ./:/opt/ez-lan-manager
|
||||
entrypoint: ["/bin/sh", "-c", "cd /opt/ez-lan-manager/src && python3 /opt/ez-lan-manager/src/EzLanManager.py"]
|
||||
|
||||
db:
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: Alkohol1
|
||||
MARIADB_DATABASE: ez_lan_manager
|
||||
MARIADB_USER: ez_lan_manager
|
||||
MARIADB_PASSWORD: Alkohol1
|
||||
healthcheck:
|
||||
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
ports:
|
||||
- "127.0.0.1:3306:3306"
|
||||
volumes:
|
||||
- database:/var/lib/mysql
|
||||
- ./sql/create_database.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
|
||||
|
||||
volumes:
|
||||
database:
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
@ -186,4 +186,7 @@ if __name__ == "__main__":
|
||||
}
|
||||
)
|
||||
|
||||
sys.exit(app.run_as_web_server())
|
||||
sys.exit(app.run_as_web_server(
|
||||
host="0.0.0.0",
|
||||
port=8000,
|
||||
))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user