From 8ff9e729722d78f708ac55c7bbd77d846c9fcdb9 Mon Sep 17 00:00:00 2001 From: "Langhammer, Jens" Date: Thu, 10 Oct 2019 17:13:06 +0200 Subject: [PATCH] docker(major): use buster instead of stretch, simplify base image, use pyuwsgi for wheels --- Dockerfile | 2 +- Pipfile | 1 + Pipfile.lock | 44 +++++++++++++++++++++++++++++++++++++------- base.Dockerfile | 21 +++++++++++---------- dev.Dockerfile | 4 +--- 5 files changed, 51 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 11ba32e02..975079cf0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM docker.beryju.org/passbook/base:latest -COPY --chown=passbook:passbook ./passbook/ /app/passbook +COPY ./passbook/ /app/passbook COPY ./manage.py /app/ COPY ./docker/uwsgi.ini /app/ diff --git a/Pipfile b/Pipfile index 7d06bd66c..77825ff20 100644 --- a/Pipfile +++ b/Pipfile @@ -35,6 +35,7 @@ service_identity = "*" signxml = "*" urllib3 = {extras = ["secure"],version = "*"} structlog = "*" +pyuwsgi = "*" [requires] python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index e5445b4e3..3257b834c 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "53d7190ea62f504dc1a36eae952a273e0b2d9f313f23031099d039c3146235b7" + "sha256": "1f0a33bfd6eeb5d7dcc9b734eaf7250f84e84ff1b6e7f6fd0483ecf11fef4537" }, "pipfile-spec": 6, "requires": { @@ -101,10 +101,10 @@ }, "cheroot": { "hashes": [ - "sha256:6168371ab9aaf574ac5f75675f244bbfebf990202bf75048065e9d675b9ae719", - "sha256:8cc7c28961db2e13d0cac6b234a589a314c1844f7bbf54e67888ac9a2e25ac59" + "sha256:3ff64073efa35b39d5e107410f5c79664dc8c6c5990651e970740c80ab8878a8", + "sha256:d523a1525258730026aa35b86c8c47c8d0e3892fb89f0f39157d4b32a50edf05" ], - "version": "==7.0.0" + "version": "==8.1.0" }, "cherrypy": { "hashes": [ @@ -459,10 +459,10 @@ }, "pyasn1-modules": { "hashes": [ - "sha256:43c17a83c155229839cc5c6b868e8d0c6041dba149789b6d6e28801c64821722", - "sha256:e30199a9d221f1b26c885ff3d87fd08694dbbe18ed0e8e405a2a7126d30ce4c0" + "sha256:0c35a52e00b672f832e5846826f1fb7507907f7d52fba6faa9e3c4cbe874fe4b", + "sha256:b6ada4f840fe51abf5a6bd545b45bf537bea62221fa0dde2e8a553ed9f06a4e3" ], - "version": "==0.2.6" + "version": "==0.2.7" }, "pycparser": { "hashes": [ @@ -564,6 +564,36 @@ ], "version": "==2019.3" }, + "pyuwsgi": { + "hashes": [ + "sha256:15a4626740753b0d0dfeeac7d367f9b2e89ab6af16c195927e60f75359fc1bbc", + "sha256:24c40c3b889eb9f283d43feffbc0f7c7fc024e914451425156ddb68af3df1e71", + "sha256:393737bd43a7e38f0a4a1601a37a69c4bf893635b37665ff958170fdb604fdb7", + "sha256:5a08308f87e639573c1efaa5966a6d04410cd45a73c4586a932fe3ee4b56369d", + "sha256:5f4b36c0dbb9931c4da8008aa423158be596e3b4a23cec95a958631603a94e45", + "sha256:7c31794f71bbd0ccf542cab6bddf38aa69e84e31ae0f9657a2e18ebdc150c01a", + "sha256:802ec6dad4b6707b934370926ec1866603abe31ba03c472f56149001b3533ba1", + "sha256:814d73d4569add69a6c19bb4a27cd5adb72b196e5e080caed17dbda740402072", + "sha256:829299cd117cf8abe837796bf587e61ce6bfe18423a3a1c510c21e9825789c2c", + "sha256:85f2210ceae5f48b7d8fad2240d831f4b890cac85cd98ca82683ac6aa481dfc8", + "sha256:861c94442b28cd64af033e88e0f63c66dbd5609f67952dc18694098b47a43f3a", + "sha256:957bc6316ffc8463795d56d9953d58e7f32aa5aad1c5ac80bc45c69f3299961e", + "sha256:9760c3f56fb5f15852d163429096600906478e9ed2c189a52f2bb21d8a2a986c", + "sha256:a4b24703ea818196d0be1dc64b3b57b79c67e8dee0cfa207a4216220912035a7", + "sha256:ad7f4968c1ddbf139a306d9b075360d959cc554d994ba5e1f512af9a40e62357", + "sha256:b1127d34b90f74faf1707718c57a4193ac028b9f4aec0238638983132297d456", + "sha256:bcb04d6ec644b3e08d03c64851e06edd7110489261e50627a4bcadf66ff6920e", + "sha256:bebfebb9ee83d7cf37668bf54275b677b7ae283e84a944f9f3ac6a4b66f95d4b", + "sha256:c29892dafc65a8b6eb95823fa4bac7754ca3fd1c28ab8d2a973289531b340a27", + "sha256:cb296b50b51ba022b0090b28d032ff1dd395a6db03672b65a39e83532edad527", + "sha256:ce777ebdf49ce736fc04abf555b5c41ab3f130127543a689dcf8d4871cd18fe4", + "sha256:d8b4bf930b6a19bc9ee982b9163d948c87501ad91b71516924e8ed25fe85d2ee", + "sha256:e2a420f2c4d35f3ec0b7e752a80d7bd385e2c5a64f67c05f2d2d74230e3114b6", + "sha256:fed899ce96f4f2b4d1b9f338dd145a4040ee1d8a5152213af0dd8d4a4d36e9fe" + ], + "index": "pypi", + "version": "==2.0.18.post0" + }, "pyyaml": { "hashes": [ "sha256:0113bc0ec2ad727182326b61326afa3d1d8280ae1122493553fd6f4397f33df9", diff --git a/base.Dockerfile b/base.Dockerfile index 5eec1f851..f46c29376 100644 --- a/base.Dockerfile +++ b/base.Dockerfile @@ -1,18 +1,19 @@ -FROM python:3.7-slim-stretch +FROM python:3.7-slim-buster as locker COPY ./Pipfile /app/ COPY ./Pipfile.lock /app/ WORKDIR /app/ -RUN apt-get update && \ - apt-get install -y --no-install-recommends build-essential && \ - pip install pipenv uwsgi --no-cache-dir && \ - apt-get remove -y --purge build-essential && \ - apt-get autoremove -y --purge && \ - rm -rf /var/lib/apt/lists/* +RUN pip install pipenv && \ + pipenv lock -r > requirements.txt && \ + pipenv lock -rd > requirements-dev.txt -RUN pipenv lock -r > requirements.txt && \ - pipenv --rm && \ - pip install -r requirements.txt --no-cache-dir && \ +FROM python:3.7-slim-buster + +COPY --from=locker /app/requirements.txt /app/ + +WORKDIR /app/ + +RUN pip install -r requirements.txt --no-cache-dir && \ adduser --system --no-create-home --uid 1000 --group --home /app passbook diff --git a/dev.Dockerfile b/dev.Dockerfile index 4bdc708c8..9081e6532 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -1,5 +1,3 @@ FROM docker.beryju.org/passbook/base:latest -RUN pipenv lock --dev -r > requirements-dev.txt && \ - pipenv --rm && \ - pip install -r /app/requirements-dev.txt --no-cache-dir +RUN pip install -r /app/requirements-dev.txt --no-cache-dir