Added docker support

This commit is contained in:
FrederikBaerentsen 2024-06-18 16:46:34 +02:00
parent 216b8fe7eb
commit 45026c37dd
5 changed files with 31 additions and 3 deletions

1
.env.sample Normal file
View File

@ -0,0 +1 @@
REBRICKABLE_API_KEY=xxxx

6
Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM python:slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]

View File

@ -1,2 +1,11 @@
# LEGOOrganizer
git clone
`cp .env.sample .env`
`nano .env`
change api key and save file
docker compose up -d

8
app.py
View File

@ -1,4 +1,5 @@
from flask import Flask, request, redirect, jsonify, render_template, Response,url_for
import os
import json
from flask_socketio import SocketIO
from threading import Thread
@ -107,9 +108,10 @@ def new_set(set_num):
# >>>>>>>>
progress(count, total_parts,'Adding set: ' + set_num)
with open('api','r') as f:
api_key = f.read().replace('\n','')
rb = rebrick.init(api_key)
#with open('api','r') as f:
# api_key = f.read().replace('\n','')
# TODO add 401 error on wrong key
rb = rebrick.init(os.getenv("REBRICKABLE_API_KEY"))
# >>>>>>>>
progress(count, total_parts,'Generating Unique ID')

10
compose.yaml Normal file
View File

@ -0,0 +1,10 @@
services:
legoorganizer:
container_name: LEGOOrganizer
build: .
ports:
- "5111:3333"
volumes:
- .:/app
env_file:
- .env