Skip to content

Commit e721092

Browse files
committed
Changes the Dockerfile to use pipenv and the releases to use pipenv, removing the need for a requirements.txt
1 parent 8c7afc5 commit e721092

File tree

4 files changed

+47
-131
lines changed

4 files changed

+47
-131
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,27 @@ jobs:
243243
-
244244
name: Checkout
245245
uses: actions/checkout@v3
246+
-
247+
name: Install pipenv
248+
run: |
249+
pip3 install --upgrade pip setuptools wheel pipx
250+
pipx install pipenv
246251
-
247252
name: Set up Python
248253
uses: actions/setup-python@v4
249254
with:
250255
python-version: 3.9
256+
cache: "pipenv"
257+
cache-dependency-path: 'Pipfile.lock'
251258
-
252-
name: Install dependencies
259+
name: Install Python dependencies
260+
run: |
261+
pipenv sync --dev
262+
-
263+
name: Install system dependencies
253264
run: |
254265
sudo apt-get update -qq
255266
sudo apt-get install -qq --no-install-recommends gettext liblept5
256-
pip3 install --upgrade pip setuptools wheel
257-
pip3 install -r requirements.txt
258267
-
259268
name: Download frontend artifact
260269
uses: actions/download-artifact@v3
@@ -267,34 +276,38 @@ jobs:
267276
with:
268277
name: documentation
269278
path: docs/_build/html/
279+
-
280+
name: Generate requirements file
281+
run: |
282+
pipenv requirements > requirements.txt
283+
-
284+
name: Compile messages
285+
run: |
286+
cd src/
287+
pipenv run python3 manage.py compilemessages
288+
-
289+
name: Collect static files
290+
run: |
291+
cd src/
292+
pipenv run python3 manage.py collectstatic --no-input
270293
-
271294
name: Move files
272295
run: |
273296
mkdir dist
274297
mkdir dist/paperless-ngx
275298
mkdir dist/paperless-ngx/scripts
276-
cp .dockerignore .env Dockerfile Pipfile Pipfile.lock LICENSE README.md requirements.txt dist/paperless-ngx/
299+
cp .dockerignore .env Dockerfile Pipfile Pipfile.lock requirements.txt LICENSE README.md dist/paperless-ngx/
277300
cp paperless.conf.example dist/paperless-ngx/paperless.conf
278301
cp gunicorn.conf.py dist/paperless-ngx/gunicorn.conf.py
279-
cp docker/ dist/paperless-ngx/docker -r
302+
cp -r docker/ dist/paperless-ngx/docker
280303
cp scripts/*.service scripts/*.sh dist/paperless-ngx/scripts/
281-
cp src/ dist/paperless-ngx/src -r
282-
cp docs/_build/html/ dist/paperless-ngx/docs -r
283-
-
284-
name: Compile messages
285-
run: |
286-
cd dist/paperless-ngx/src
287-
python3 manage.py compilemessages
288-
-
289-
name: Collect static files
290-
run: |
291-
cd dist/paperless-ngx/src
292-
python3 manage.py collectstatic --no-input
304+
cp -r src/ dist/paperless-ngx/src
305+
cp -r docs/_build/html/ dist/paperless-ngx/docs
306+
mv static dist/paperless-ngx
293307
-
294308
name: Make release package
295309
run: |
296310
cd dist
297-
find . -name __pycache__ | xargs rm -r
298311
tar -cJf paperless-ngx.tar.xz paperless-ngx/
299312
-
300313
name: Upload release artifact

CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
/src/ @paperless-ngx/backend
88
Pipfile* @paperless-ngx/backend
99
*.py @paperless-ngx/backend
10-
requirements.txt @paperless-ngx/backend

Dockerfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ RUN --mount=type=bind,from=qpdf-builder,target=/qpdf \
175175
&& python3 -m pip install --no-cache-dir /psycopg2/usr/src/wheels/psycopg2*.whl \
176176
&& python3 -m pip list
177177

178+
WORKDIR /usr/src/paperless/src/
179+
178180
# Python dependencies
179181
# Change pretty frequently
180-
COPY requirements.txt ../
182+
COPY Pipfile* ./
181183

182184
# Packages needed only for building a few quick Python
183185
# dependencies
@@ -191,20 +193,30 @@ RUN set -eux \
191193
&& apt-get update \
192194
&& apt-get install --yes --quiet --no-install-recommends ${BUILD_PACKAGES} \
193195
&& python3 -m pip install --no-cache-dir --upgrade wheel \
196+
&& echo "Installing pipenv" \
197+
&& python3 -m pip install --no-cache-dir --upgrade pipenv \
194198
&& echo "Installing Python requirements" \
195-
&& python3 -m pip install --default-timeout=1000 --no-cache-dir -r ../requirements.txt \
199+
# pipenv tries to be too fancy and prints so much junk
200+
&& pipenv requirements > requirements.txt \
201+
&& python3 -m pip install --default-timeout=1000 --no-cache-dir --requirement requirements.txt \
202+
&& rm requirements.txt \
196203
&& echo "Cleaning up image" \
197204
&& apt-get -y purge ${BUILD_PACKAGES} \
198205
&& apt-get -y autoremove --purge \
199206
&& apt-get clean --yes \
207+
# Remove pipenv and its unique packages
208+
&& python3 -m pip uninstall --yes \
209+
pipenv \
210+
distlib \
211+
platformdirs \
212+
virtualenv \
213+
virtualenv-clone \
200214
&& rm -rf /var/lib/apt/lists/* \
201215
&& rm -rf /tmp/* \
202216
&& rm -rf /var/tmp/* \
203217
&& rm -rf /var/cache/apt/archives/* \
204218
&& truncate -s 0 /var/log/*log
205219

206-
WORKDIR /usr/src/paperless/src/
207-
208220
# copy backend
209221
COPY ./src ./
210222

requirements.txt

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)