Skip to content

Commit

Permalink
Dockerfile: Do not pip install --user, venv instead (#3452)
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas <[email protected]>
Co-authored-by: Thomas <[email protected]>
  • Loading branch information
3 people authored Jun 6, 2023
1 parent 485d62f commit 007a673
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The types of changes are:
- Enabled Privacy Experience beta flag [#3364](https://github.com/ethyca/fides/pull/3364)
- Removed ExperienceConfig.delivery_mechanism constraint [#3387](https://github.com/ethyca/fides/pull/3387)
- Updated privacy experience UI forms to reflect updated experience config fields [#3402](https://github.com/ethyca/fides/pull/3402)
- Use a venv in the Dockerfile for installing Python deps [#3452](https://github.com/ethyca/fides/pull/3452)
- Bump SlowAPI Version [#3456](https://github.com/ethyca/fides/pull/3456)
- Bump Psycopg2-binary Version [#3473](https://github.com/ethyca/fides/pull/3473)
- Reduced duplication between PrivacyExperience and PrivacyExperienceConfig [#3470](https://github.com/ethyca/fides/pull/3470)
Expand Down
21 changes: 13 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# If you update this, also update `DEFAULT_PYTHON_VERSION` in the GitHub workflow files
ARG PYTHON_VERSION="3.10.11"


#########################
## Compile Python Deps ##
#########################
Expand All @@ -18,15 +17,21 @@ RUN apt-get update && \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Activate a Python venv
RUN python3 -m venv /opt/fides
ENV PATH="/opt/fides/bin:${PATH}"

# Install Python Dependencies
COPY dangerous-requirements.txt .
RUN if [ $TARGETPLATFORM != linux/arm64 ] ; then pip install --user -U pip --no-cache-dir install -r dangerous-requirements.txt ; fi
RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel

COPY dev-requirements.txt .
RUN pip install --user -U pip --no-cache-dir install -r dev-requirements.txt
COPY dangerous-requirements.txt .
RUN if [ $TARGETPLATFORM != linux/arm64 ] ; then pip install --no-cache-dir install -r dangerous-requirements.txt ; fi

COPY requirements.txt .
RUN pip install --user -U pip --no-cache-dir install -r requirements.txt
RUN pip install --no-cache-dir install -r requirements.txt

COPY dev-requirements.txt .
RUN pip install --no-cache-dir install -r dev-requirements.txt

##################
## Backend Base ##
Expand All @@ -35,8 +40,8 @@ FROM python:${PYTHON_VERSION}-slim-bullseye as backend
ARG TARGETPLATFORM

# Loads compiled requirements and adds the to the path
COPY --from=compile_image /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
COPY --from=compile_image /opt/fides /opt/fides
ENV PATH=/opt/fides/bin:$PATH

# These are all required for MSSQL
RUN : \
Expand Down

0 comments on commit 007a673

Please sign in to comment.