Revert "Unify dockerfile"

This reverts commit 6be02ebd26.
This commit is contained in:
vas3k 2020-12-28 16:42:49 +01:00
parent 2aa2df1ba7
commit 46f5aff238
9 changed files with 57 additions and 24 deletions

View File

@ -79,4 +79,4 @@ redeploy:
migrate \
build-frontend \
test-ci \
redeploy
redeploy-production

View File

@ -22,8 +22,11 @@ WORKDIR /app
# install requirements into a separate layer
COPY ./requirements.txt /app/requirements.txt
COPY ./dev_requirements.txt /app/dev_requirements.txt
RUN pip install -r requirements.txt
COPY ./dev_requirements.txt /app/dev_requirements.txt
RUN pip install -r dev_requirements.txt
RUN python -c "import nltk; nltk.download('punkt')"
# copy the code

12
dev.frontend.dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM node:14-slim
WORKDIR /app/frontend
COPY ./frontend/package.json ./
COPY ./frontend/package-lock.json ./
RUN npm ci
COPY ./frontend ./
RUN npm run build

View File

@ -3,7 +3,7 @@ version: "3.7"
services:
club_app: &app
build:
dockerfile: Dockerfile
dockerfile: production.dockerfile
context: .
command: make docker-run-production
container_name: club_app

View File

@ -3,9 +3,9 @@ version: "3.7"
services:
tests:
build:
dockerfile: Dockerfile
dockerfile: dev.dockerfile
context: .
command: pip install -r dev_requirements.txt && make test-ci
command: make test-ci
container_name: tests
environment:
- DEBUG=true # regardless of this value django will override it on false
@ -43,7 +43,7 @@ services:
webpack:
build:
dockerfile: frontend/Dockerfile
dockerfile: dev.frontend.dockerfile
context: .
command: npm run watch
restart: "no"

View File

@ -1,11 +1,11 @@
version: "3.7"
services:
club_app:
club_app: &app
build:
dockerfile: Dockerfile
dockerfile: dev.dockerfile
context: .
command: pip install -r dev_requirements.txt && make docker-run-dev
command: make docker-run-dev
container_name: club_app
environment:
- DEBUG=true
@ -29,9 +29,9 @@ services:
queue:
build:
dockerfile: Dockerfile
dockerfile: dev.dockerfile
context: .
command: pip install -r dev_requirements.txt && make docker-run-queue
command: make docker-run-queue
environment:
- DEBUG=true
- PYTHONUNBUFFERED=1

View File

@ -1,12 +0,0 @@
FROM node:14-slim
WORKDIR /app/frontend
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm ci
COPY ./ ./
RUN npm run build

30
production.dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM python:3.8-slim-buster
ENV DEBIAN_FRONTEND noninteractive
# required to build gdal (geo library)
ENV CPLUS_INCLUDE_PATH /usr/include/gdal
ENV C_INCLUDE_PATH /usr/include/gdal
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get install --no-install-recommends -yq \
gcc \
g++ \
libc-dev \
libpq-dev \
gdal-bin \
libgdal-dev \
make \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# install requirements into a separate layer
COPY ./requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
RUN python -c "import nltk; nltk.download('punkt')"
# copy the code
COPY . /app
COPY ./vas3k_club.env /app/club/.env

View File

@ -1,5 +1,5 @@
[flake8]
ignore = E226,E302,E41
max-line-length = 120
exclude = scripts,frontend,docs
exclude = scripts
max-complexity = 13