Improve Dockerfile and add Build action#70
Open
Paillat-dev wants to merge 5 commits intoRafaelSolVargas:masterfrom
Open
Improve Dockerfile and add Build action#70Paillat-dev wants to merge 5 commits intoRafaelSolVargas:masterfrom
Paillat-dev wants to merge 5 commits intoRafaelSolVargas:masterfrom
Conversation
|
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 |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:masterwhich 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