Skip to content

Improve Dockerfile and add Build action#70

Open
Paillat-dev wants to merge 5 commits intoRafaelSolVargas:masterfrom
Paillat-dev:master
Open

Improve Dockerfile and add Build action#70
Paillat-dev wants to merge 5 commits intoRafaelSolVargas:masterfrom
Paillat-dev:master

Conversation

@Paillat-dev
Copy link

@Paillat-dev Paillat-dev commented Apr 7, 2024

This pr improves the dockerfile by copying the files instead of cloning the repo in the container, which is much better honestly and shows I wasn't that experienced with docker when I first did this.

It also adds an action triggered on every pull request and push on the main branch that builds the docker image and publishes it at ghcr.io/RafaelSolVargas/Vulkan:master which is useful as it allows anyone to use it without needing to build the image, saving resources especially if running on cheap hardware.

Will ad docs on this same pr asap

Edit: No docs neede actually

@Paillat-dev Paillat-dev marked this pull request as ready for review April 9, 2024 10:32
@Ixarias
Copy link

Ixarias commented Feb 23, 2025

i self host your bot in docker. heres my version of the Dockerfile

FROM python:3.10.0

ENV PYTHONUNBUFFERED=1

WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt
RUN pip install -U yt-dlp
RUN apt-get update && apt-get install -y software-properties-common && apt-get install -y ffmpeg
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
COPY . .
USER appuser
CMD ["python", "main.py"]

the important thing is to copy the folder as late as possible. with your current Dockerfile, the cache of future layers is invalidated by the early COPY, meaning it has redownload and install the requirements.

also, you should add a .dockerignore, as currently your .env files will be included

build.sh
./Tests
run_tests.py
.env*

@Paillat-dev
Copy link
Author

I don't host this bot anymore, and should probably close this pr. But yeah you're 100% right, what I did was just a very simple thing that worked. Lmk if you want to take over this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants