Skip to content

Commit

Permalink
Keep the dev Dockerfile as a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhiek187 committed Sep 10, 2022
1 parent af18709 commit a7a0baf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
24 changes: 24 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Start with a lightweight python 3 image
FROM python:3-alpine

# Send python output in real-time without needing to be buffered
ENV PYTHONUNBUFFERED=1
# Don't write .pyc files when importing source modules
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /code
COPY requirements.txt /code

# Install the packages needed to install psycopg2-binary: https://stackoverflow.com/a/47871121
RUN \
apk add --no-cache postgresql-libs && \
apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev && \
# Install all python dependencies
pip install -r requirements.txt --no-cache-dir && \
apk --purge del .build-deps

COPY . /code
WORKDIR /code/stockhelper
# Initialize the SQLite databases
RUN python manage.py migrate
# Load the flashcards data
RUN python manage.py loaddata cards.json
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Docker Compose for dev builds only
version: "3.9"

services:
web:
build: .
build:
context: .
dockerfile: Dockerfile.dev
command: >
sh -c "python manage.py migrate &&
python manage.py loaddata cards.json &&
Expand Down

0 comments on commit a7a0baf

Please sign in to comment.