-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
436 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
build/ | ||
*.egg-info/ | ||
venv/ | ||
.git/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# This file is for use with docker compose so that mounting Neo4j volumes doesn't fail with perms errs | ||
GID=10001 | ||
UID=10001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ build/ | |
.compose | ||
generated | ||
dist/ | ||
.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
FROM ubuntu:focal | ||
# This is a thin distribution of the cartography software. | ||
FROM python:3.10-slim | ||
|
||
WORKDIR /srv/cartography | ||
# the UID and GID to run cartography as | ||
# (https://github.com/hexops/dockerfile#do-not-use-a-uid-below-10000). | ||
ARG uid=10001 | ||
ARG gid=10001 | ||
|
||
ENV PATH=/venv/bin:$PATH | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3.10-dev python3-pip python3-setuptools openssl libssl-dev gcc pkg-config libffi-dev libxml2-dev libxmlsec1-dev curl make git && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
WORKDIR /var/cartography | ||
ENV HOME=/var/cartography | ||
|
||
# Installs pip supported by python3.10 | ||
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.10 get-pip.py | ||
RUN pip install cartography | ||
|
||
# Create cartography user so that we can give it ownership of the directory later for unit&integ tests | ||
RUN groupadd cartography && \ | ||
useradd -s /bin/bash -d /home/cartography -m -g cartography cartography | ||
USER ${uid}:${gid} | ||
|
||
# Installs python dependencies | ||
COPY setup.py test-requirements.txt ./ | ||
RUN pip install -e . && \ | ||
pip install -r test-requirements.txt && \ | ||
# Grant write access to the directory for unit and integration test coverage files | ||
chmod -R a+w /srv/cartography | ||
# verify that the binary at least runs | ||
RUN cartography -h | ||
|
||
# Install cartography, setting the owner so that tests work | ||
COPY --chown=cartography:cartography . /srv/cartography | ||
|
||
USER cartography | ||
|
||
# Sets the directory as safe due to a mismatch in the user that cloned the repo | ||
# and the user that is going to run the unit&integ tests. | ||
RUN git config --global --add safe.directory /srv/cartography | ||
RUN /usr/bin/git config --local user.name "cartography" | ||
ENTRYPOINT ["cartography"] | ||
CMD ["-h"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Builds cartography container for development by performing a Python editable install of the current source code. | ||
FROM python:3.10-slim | ||
|
||
# the UID and GID to run cartography as | ||
# (https://github.com/hexops/dockerfile#do-not-use-a-uid-below-10000). | ||
ARG uid=10001 | ||
ARG gid=10001 | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends make git && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Assumption: current working directory is the cartography source tree from github. | ||
COPY . /var/cartography | ||
WORKDIR /var/cartography | ||
ENV HOME=/var/cartography | ||
|
||
RUN pip install -U -e . && \ | ||
pip install -r test-requirements.txt && \ | ||
# Grant write access to the directory for unit and integration test coverage files | ||
chmod -R a+w /var/cartography && \ | ||
# Sets the directory as safe due to a mismatch in the user that cloned the repo | ||
# and the user that is going to run the unit&integ tests. This lets pre-commit work. | ||
git config --global --add safe.directory /var/cartography && \ | ||
git config --local user.name "cartography" | ||
|
||
USER ${uid}:${gid} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.