Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 25 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
FROM python:3.12

RUN apt update \
&& apt install -y --no-install-recommends docker.io vim unixodbc-dev \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
wget \
unzip \
&& install -m 0755 -d /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 security (llm): It's a good practice to verify the integrity of the GPG keys when adding them, especially for critical packages like Docker. This ensures the authenticity of the packages being installed.

&& chmod a+r /etc/apt/keyrings/docker.asc \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt /tmp/requirements.txt
RUN pip3 install -r /tmp/requirements.txt
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt

# Install vnu (html/css validator)
RUN wget https://github.com/validator/validator/releases/download/20.6.30/vnu.linux.zip && \
unzip vnu.linux.zip -d /opt/vnu/ && \
chmod +x /opt/vnu/vnu-runtime-image/bin/vnu
ENV PATH=/opt/vnu/vnu-runtime-image/bin:$PATH
RUN wget https://github.com/validator/validator/releases/download/20.6.30/vnu.linux.zip -O /tmp/vnu.linux.zip \
&& unzip /tmp/vnu.linux.zip -d /opt/vnu/ \
&& chmod +x /opt/vnu/vnu-runtime-image/bin/vnu \
&& rm /tmp/vnu.linux.zip

RUN adduser --disabled-password --gecos '' app-user
ENV PATH=/opt/vnu/vnu-runtime-image/bin:$PATH

RUN mkdir -p /app_dir/lms
RUN chown -R app-user:app-user /app_dir
RUN adduser --disabled-password --gecos '' app-user \
&& mkdir -p /app_dir/lms \
&& chown -R app-user:app-user /app_dir

# Note: we don't copy the code to container because we mount the code in different ways
# on each setup
WORKDIR /app_dir/lms
ENV LOGURU_LEVEL INFO
ENV PYTHONPATH /app_dir/:$PYTHONPATH
ENV LOGURU_LEVEL=INFO
ENV PYTHONPATH=/app_dir/:$PYTHONPATH
# Note: Code is mounted at runtime, hence not copied.
3 changes: 2 additions & 1 deletion lms/lmstests/public/unittests/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM python:3.12-slim

COPY requirements.txt /tmp/requirements.txt
RUN pip3 install -r /tmp/requirements.txt
RUN pip config --user set global.progress_bar off && \
pip3 install -r /tmp/requirements.txt

RUN adduser --disabled-password --gecos '' app-user

Expand Down