📦 chore(.dockerignore): add .env and .git to the Docker ignore list

🐳 chore(Dockerfile): remove unnecessary installation of git and update Dockerfile to copy files instead of cloning repository
The .env and .git files are now added to the .dockerignore file to prevent them from being included in the Docker image. This is done to ensure that sensitive information and version control files are not included in the image.
In the Dockerfile, the installation of git has been removed as it is no longer needed. Instead of cloning the repository, the Dockerfile now copies the required files directly. This improves the build process by reducing unnecessary steps and dependencies.
This commit is contained in:
2023-10-31 12:56:47 +01:00
parent ec6ba8663b
commit c0d6b3f2d5
2 changed files with 5 additions and 7 deletions

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
.env
.git

View File

@@ -6,16 +6,12 @@ ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV TZ=Europe/Paris
# Install git
RUN apt-get update && \
apt-get install -y git && \
rm -rf /var/lib/apt/lists/*
# Install pip requirements
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /Botator
WORKDIR /Botator
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN git clone https://github.com/Paillat-dev/Botator.git
WORKDIR /Botator
COPY . .
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /Botator
USER appuser
CMD ["python", "main.py"]