Skip to content

Commit

Permalink
more docker refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeeeenster committed May 31, 2020
1 parent 60f2643 commit 07fa3d8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ venv
checkstyle.txt
.python-version
.env
.direnv
.envrc
34 changes: 20 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
FROM python:3.8
ENV PYTHONUNBUFFERED 1

RUN rm /var/lib/dpkg/info/format
RUN printf "1\n" > /var/lib/dpkg/info/format
RUN dpkg --configure -a
RUN apt-get clean && apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge -y --auto-remove gcc
FROM python:3.8 as build

#RUN rm /var/lib/dpkg/info/format
#RUN printf "1\n" > /var/lib/dpkg/info/format
#RUN dpkg --configure -a
#RUN apt-get clean && apt-get update \
# && apt-get install -y --no-install-recommends \
# postgresql-client \
# && rm -rf /var/lib/apt/lists/* \
# && apt-get purge -y --auto-remove gcc

RUN pip install pipenv
RUN mkdir /app

WORKDIR /app
COPY Pipfile Pipfile.lock /app/
RUN bash -c 'PIPENV_VENV_IN_PROJECT=1 pipenv install'


FROM python:3.8-slim as application

WORKDIR /app
COPY --from=build /app /app/

COPY src/ /app/
COPY src/ /app/src/
COPY bin/ /app/bin/
COPY Pipfile* /app/

RUN pipenv install
ENV DJANGO_SETTINGS_MODULE=app.settings.master-docker
EXPOSE 8000

Expand Down
4 changes: 2 additions & 2 deletions bin/docker
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e

pipenv run python /app/src/manage.py migrate
pipenv run python src/manage.py runserver 0.0.0.0:8000
.venv/bin/python src/manage.py migrate
.venv/bin/python src/manage.py runserver 0.0.0.0:8000

0 comments on commit 07fa3d8

Please sign in to comment.