diff --git a/.dockerignore b/.dockerignore index fb3a569..7425896 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,4 +9,5 @@ __pycache__ .gitignore Dockerfile docker-compose.yml -log.md \ No newline at end of file +log.md +.vscode \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9d83d26..606b1bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ log.md .env +.vscode # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Dockerfile b/Dockerfile index 0e21369..32522bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,17 +15,17 @@ WORKDIR /app # Install Python dependencies COPY requirements.txt . -RUN pip install --upgrade pip -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt # Copy application files COPY . /app # Make start.sh executable -RUN chmod +x start.sh +COPY start.sh . +RUN chmod +x ./start.sh # Expose the port the app runs on EXPOSE 1986 # Specify the entrypoint script -ENTRYPOINT ["./start.sh"] +ENTRYPOINT ["/app/start.sh"] diff --git a/app/main.py b/app/main.py index edce716..13157a0 100644 --- a/app/main.py +++ b/app/main.py @@ -58,8 +58,12 @@ import pytz from datetime import datetime def log(str): - with open("logs/log.md", "at") as file: - file.write(str) + try: + with open("logs/log.md", "a") as file: + file.write(str) + except FileNotFoundError: + os.system("touch logs/log.md") + log("#### log.md was not found, so it was just touched.") ### OpenAI Config @@ -125,4 +129,6 @@ def get_auto_transcript(video_id): txt_transcript = formatter.format_transcript(transcript) return txt_transcript -output_stream = StreamOutput() \ No newline at end of file +output_stream = StreamOutput() + +log(f"# Main initilized at {datetime.now(pytz.timezone('America/New_York')).strftime('%Y-%m-%d %H:%M:%S')}. Presumeably application starting.") \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 403d03b..9346b88 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,12 @@ -version: '3.8' - services: app: build: . - container_name: screw-bardo-container + container_name: screw-bardo ports: - "1986:1986" env_file: - .env volumes: - - ./logs:/app/logs - restart: unless-stopped \ No newline at end of file + - ./app/logs:/app/app/logs/:rw + restart: unless-stopped + \ No newline at end of file diff --git a/start.sh b/start.sh index 6228c5a..d787f11 100644 --- a/start.sh +++ b/start.sh @@ -1,3 +1,3 @@ #!/bin/bash -cd ./app +cd app exec gunicorn -b 0.0.0.0:1986 --log-level debug app:app \ No newline at end of file