Vulkan icon indicating copy to clipboard operation
Vulkan copied to clipboard

Improve Dockerfile and add Build action

Open Paillat-dev opened this issue 2 years ago • 2 comments

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 avatar Apr 07 '24 23:04 Paillat-dev

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*

Ixarias avatar Feb 23 '25 05:02 Ixarias

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

Paillat-dev avatar Feb 23 '25 11:02 Paillat-dev