Skip to content

Commit

Permalink
First work
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeeeenster committed May 31, 2020
1 parent 4b79c2f commit 60f2643
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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

RUN pip install pipenv
RUN mkdir /app
WORKDIR /app

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

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

CMD ["./bin/docker"]
25 changes: 25 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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/* \
&& apk add --no-cache --virtual .build-deps gcc musl-dev

RUN pip install pipenv
RUN mkdir /app
WORKDIR /app

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

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

CMD ["./bin/docker-dev"]
5 changes: 5 additions & 0 deletions bin/docker
Original file line number Diff line number Diff line change
@@ -0,0 +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
5 changes: 5 additions & 0 deletions bin/docker-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

pipenv run python src/manage.py migrate
pipenv run python src/manage.py runserver 0.0.0.0:8000
30 changes: 30 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
services:
db:
image: postgres
container_name: db
environment:
POSTGRES_DB: bullettrain
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
api:
build:
context: .
dockerfile: Dockerfile.dev
command: ./bin/docker-dev
volumes:
- .:/app
environment:
DJANGO_DB_NAME: bullettrain
DJANGO_DB_USER: postgres
DJANGO_DB_PASSWORD: password
DJANGO_DB_PORT: 5432
DJANGO_ALLOWED_HOSTS: localhost
ports:
- "8000:8000"
depends_on:
- db
links:
- db:db

0 comments on commit 60f2643

Please sign in to comment.