Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile to focal and reorder steps #1158

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:bionic
FROM ubuntu:focal

WORKDIR /srv/cartography

Expand All @@ -7,15 +7,18 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3.8-dev python3-pip python3-setuptools openssl libssl-dev gcc pkg-config libffi-dev libxml2-dev libxmlsec1-dev curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY . /srv/cartography

# Installs pip supported by python3.8
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.8 get-pip.py

# Installs python dependencies
COPY setup.py test-requirements.txt ./
RUN pip install -e . && \
pip install -r test-requirements.txt

# Install cartography
COPY . /srv/cartography

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for taking care to upgrade. Can you explain what this line is for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before :
copying source code was done before installing dependencies, so any change will trigger dependencies install

After :
first only requirements are copied, so the docker layer is cached
then files are copied, so change in files wont trigger a new dependencies install

RUN groupadd cartography && \
useradd -s /bin/bash -d /home/cartography -m -g cartography cartography

USER cartography
Loading