Skip to content
Snippets Groups Projects
Select Git revision
  • master default
  • test protected
  • pdp
  • localwebs
  • target-groups
  • seo1
  • fix1
7 results

Dockerfile

Blame
  • Forked from TO / Maják
    2031 commits behind the upstream repository.
    Dockerfile 1.01 KiB
    FROM python:3.8
    
    RUN apt-get update && apt-get install -y \
        # requirements to build python-ldap
        build-essential python3-dev libldap2-dev libsasl2-dev \
        && rm -rf /var/lib/apt/lists/*
    
    RUN mkdir /app
    WORKDIR /app
    
    COPY requirements requirements/
    RUN pip install -r requirements/base.txt -r requirements/production.txt
    
    COPY . .
    
    RUN bash -c 'adduser --disabled-login --quiet --gecos app app &&  \
                 chmod -R o+r /app/ && \
                 mkdir /app/media_files && \
                 mkdir /app/static_files && \
                 chown -R app:app /app/media_files && \
                 chown -R app:app /app/static_files && \
                 chmod o+x /app/run.sh'
    USER app
    
    ENV DJANGO_SETTINGS_MODULE "majak.settings.production"
    
    # fake values for required env variables used to run collectstatic during build
    RUN DJANGO_SECRET_KEY=x DATABASE_URL=postgres://x/x DJANGO_ALLOWED_HOSTS=x \
        OIDC_RP_CLIENT_ID=x OIDC_RP_CLIENT_SECRET=x OIDC_RP_REALM_URL=x \
        python manage.py collectstatic
    
    EXPOSE 8000
    
    CMD ["bash", "run.sh"]