Skip to content

Commit

Permalink
chore: upgrade argilla-server Docker image trying to fix some vulnera…
Browse files Browse the repository at this point in the history
…bilities (#5486)

# Description

This PR includes some changes to our Dockerfile at argilla-server:
* Increase Python Docker image from `python:3.10.12-slim` to
`python:3.10.15-slim`.
* Add calls to `apt-get upgrade` so we have the latest version of the
dependencies.

**Type of change**

- Improvement (change adding some improvement to an existing
functionality)

**How Has This Been Tested**

- [x] Manually check that the generated Docker image does not have
vulnerabilities or at least some of them disappear.
- [x] Manually test that HF Spaces correctly support these changes.

**Checklist**

- I added relevant documentation
- I followed the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
  • Loading branch information
jfcalvo committed Sep 17, 2024
1 parent bf08e83 commit 3f8a732
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions argilla-server/docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
FROM python:3.10.12-slim AS builder
FROM python:3.10-slim AS builder

# Copying argilla distribution files
COPY dist/*.whl /packages/
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN apt-get update && \
apt-get install -y python-dev-is-python3 libpq-dev gcc && \
pip install --upgrade pip && \
pip install uvicorn[standard] && \
for wheel in /packages/*.whl; do pip install "$wheel"[server,postgresql]; done && \
apt-get remove -y python-dev-is-python3 libpq-dev gcc && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /packages

FROM python:3.10.12-slim
apt-get upgrade -y && \
apt-get install -y python-dev-is-python3 libpq-dev gcc && \
pip install --upgrade pip && \
pip install uvicorn[standard] && \
for wheel in /packages/*.whl; do pip install "$wheel"[server,postgresql]; done && \
apt-get remove -y python-dev-is-python3 libpq-dev gcc && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /packages

FROM python:3.10-slim

# Environment Variables
ENV USERNAME=""
Expand All @@ -31,12 +32,13 @@ RUN useradd -ms /bin/bash argilla

# Create argilla volume
RUN mkdir -p "$ARGILLA_HOME_PATH" && \
chown argilla:argilla "$ARGILLA_HOME_PATH" && \
apt-get update && \
apt-get install -y libpq-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /packages
chown argilla:argilla "$ARGILLA_HOME_PATH" && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y libpq-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /packages
VOLUME $ARGILLA_HOME_PATH

COPY scripts/start_argilla_server.sh /home/argilla
Expand Down

0 comments on commit 3f8a732

Please sign in to comment.