From c0d6b3f2d58d8122c35a14cdb0869007eea4462a Mon Sep 17 00:00:00 2001 From: Paillat Date: Tue, 31 Oct 2023 12:56:47 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20chore(.dockerignore):=20add=20.e?= =?UTF-8?q?nv=20and=20.git=20to=20the=20Docker=20ignore=20list=20?= =?UTF-8?q?=F0=9F=90=B3=20chore(Dockerfile):=20remove=20unnecessary=20inst?= =?UTF-8?q?allation=20of=20git=20and=20update=20Dockerfile=20to=20copy=20f?= =?UTF-8?q?iles=20instead=20of=20cloning=20repository=20The=20.env=20and?= =?UTF-8?q?=20.git=20files=20are=20now=20added=20to=20the=20.dockerignore?= =?UTF-8?q?=20file=20to=20prevent=20them=20from=20being=20included=20in=20?= =?UTF-8?q?the=20Docker=20image.=20This=20is=20done=20to=20ensure=20that?= =?UTF-8?q?=20sensitive=20information=20and=20version=20control=20files=20?= =?UTF-8?q?are=20not=20included=20in=20the=20image.=20In=20the=20Dockerfil?= =?UTF-8?q?e,=20the=20installation=20of=20git=20has=20been=20removed=20as?= =?UTF-8?q?=20it=20is=20no=20longer=20needed.=20Instead=20of=20cloning=20t?= =?UTF-8?q?he=20repository,=20the=20Dockerfile=20now=20copies=20the=20requ?= =?UTF-8?q?ired=20files=20directly.=20This=20improves=20the=20build=20proc?= =?UTF-8?q?ess=20by=20reducing=20unnecessary=20steps=20and=20dependencies.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 2 ++ Dockerfile | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..255f49d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.env +.git \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2f17ab6..ed6fd2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file