aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoradamjanovsky2023-07-13 14:22:01 +0200
committerGitHub2023-07-13 14:22:01 +0200
commit9de96f444ec0f59dc27b8ae489dc20bebd0cd9af (patch)
tree767415561de3b8be1feb9cba40ce22e4a776c183
parent7cdcc1ffe10150a9765fabaadd4e328e2f9c5e50 (diff)
parentc28401844ceb3864d08587672acd5828d2b892f6 (diff)
downloadsec-certs-9de96f444ec0f59dc27b8ae489dc20bebd0cd9af.tar.gz
sec-certs-9de96f444ec0f59dc27b8ae489dc20bebd0cd9af.tar.zst
sec-certs-9de96f444ec0f59dc27b8ae489dc20bebd0cd9af.zip
Merge pull request #348 from crocs-muni/issue/339-Dont-clone-in-Dockerfile-copy-contents
don't clone in dockerfile, copy local repo contents
-rw-r--r--.dockerignore2
-rw-r--r--Dockerfile22
2 files changed, 19 insertions, 5 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..557a30ab
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+# The directory with the datasets
+dataset/
diff --git a/Dockerfile b/Dockerfile
index 3dbe6681..a52458f9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,3 +1,16 @@
+# First stage just copies the content of the git repo to /tmp so that we can copy it to the final image
+# Note that if your folder with repository contains some large files, they should be added to .dockerignore
+FROM ubuntu:jammy-20220428 AS intermediate
+
+RUN apt-get update
+RUN apt-get install git -y
+
+WORKDIR /tmp
+COPY . /tmp
+RUN mkdir /output
+RUN git ls-files | xargs cp -r --parents -t /output
+COPY .git /output/.git
+
FROM ubuntu:jammy-20220428
ENV USER="user"
@@ -30,12 +43,11 @@ RUN adduser --disabled-password \
RUN chown -R ${NB_UID}:${NB_GID} ${HOME}
USER ${USER}
-WORKDIR ${HOME}
-
-# Due to setuptools_scm for versioning, we need whole repository with .git
-RUN git clone https://github.com/crocs-muni/sec-certs
+# Get the intermediate files from the previous stage
+RUN mkdir ${HOME}/sec-certs
WORKDIR ${HOME}/sec-certs
+COPY --chown=${NB_UID}:${NB_GID} --from=intermediate /output ${HOME}/sec-certs
# Create virtual environment
ENV VENV_PATH=${HOME}/venv
@@ -51,7 +63,7 @@ RUN \
pip3 install -e . && \
python3 -m spacy download en_core_web_sm
-# #just to be sure that pdftotext is in $PATH
+# just to be sure that pdftotext is in $PATH
ENV PATH /usr/bin/pdftotext:${PATH}
# # Run the application: