From 072619a238333012e8e97a8981be42bc35f77fe8 Mon Sep 17 00:00:00 2001 From: Mathias Ertl Date: Sat, 3 Nov 2018 23:02:06 +0100 Subject: [PATCH] fix dockerfile --- Dockerfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 901e1e8de..811fe41b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,22 +3,26 @@ #################### FROM python:3-alpine as test WORKDIR /usr/src/django-ca +RUN apk --no-cache add --update gcc linux-headers libc-dev libffi-dev libressl-dev make + COPY requirements.txt requirements-dev.txt setup.py tox.ini ./ -RUN apk --no-cache add --update gcc linux-headers libc-dev libffi-dev libressl-dev +COPY ca/ ca/ # Additional utilities required for testing: -RUN apk --no-cache add --update make RUN pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt +# Add user (some tests check if it's impossible to write a file) +RUN addgroup -g 9000 -S django-ca && \ + adduser -S -u 9000 -G django-ca django-ca +USER django-ca:django-ca + # copy this late so that changes do not trigger a cache miss during build -COPY ca/ ca/ RUN python setup.py code_quality RUN python setup.py test # cleanup some files so they are not included later +USER root:root RUN rm -r ca/django_ca/tests/ -RUN find ca/ | grep pyc$ | xargs rm -RUN find ca/ -type d | grep __pycache__ | xargs rmdir ###################### # Actual build stage #