Browse Source

Merge pull request #1110 from doccano/enhancement/speedupBuild

Improve build speed on production compose
pull/1156/head
Hiroki Nakayama 4 years ago
committed by GitHub
parent
commit
6440e1b8f8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 52 deletions
  1. 18
      app/Dockerfile
  2. 2
      docker-compose.dev.yml
  3. 3
      docker-compose.prod.yml
  4. 43
      docker-compose.yml

18
app/Dockerfile

@ -1,4 +1,5 @@
FROM alpine:3.9.6
ARG PYTHON_VERSION="3.8.6"
FROM python:${PYTHON_VERSION}-slim-buster
CMD ["python3"]
@ -9,8 +10,13 @@ ENV PYTHONUNBUFFERED 1
COPY . /app/
RUN apk add -U --no-cache bash python3 python3-dev libpq postgresql-dev unixodbc-dev musl-dev g++ libffi-dev \
&& pip3 install --upgrade --no-cache-dir pip setuptools \
&& pip3 install --no-cache-dir -r requirements.txt \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& apk del --no-cache python3-dev postgresql-dev unixodbc-dev musl-dev g++ libffi-dev
# hadolint ignore=DL3013
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
netcat=1.10-41.1 \
libpq-dev=11.9-0+deb10u1 \
unixodbc-dev=2.3.6-0.1 \
g++=4:8.3.0-1 \
&& pip install --no-cache-dir -U pip setuptools \
&& pip install --no-cache-dir -r requirements.txt \
&& apt-get clean

2
docker-compose.dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
backend:
image: python:3.6
image: python:3.8.6-buster
volumes:
- .:/src
- venv:/src/venv

3
docker-compose.prod.yml

@ -23,10 +23,9 @@ services:
build: ./frontend
environment:
API_URL: "http://backend:8000"
GOOGLE_TRACKING_ID: ""
volumes:
- www:/app/dist
environment:
GOOGLE_TRACKING_ID: ""
nginx:
build: ./nginx

43
docker-compose.yml

@ -1,43 +0,0 @@
version: "3"
services:
django:
image: python:3.6
volumes:
- .:/src
- venv:/src/venv
command: ["/src/tools/dev-django.sh", "0.0.0.0:8000"]
environment:
ADMIN_USERNAME: "admin"
ADMIN_PASSWORD: "password"
ADMIN_EMAIL: "admin@example.com"
DATABASE_URL: "postgres://doccano:doccano@postgres:5432/doccano?sslmode=disable"
ALLOW_SIGNUP: "False"
ports:
- 8000:8000
webpack:
image: node:8
volumes:
- .:/src
- node_modules:/src/app/server/static/node_modules
command: ["/src/tools/dev-webpack.sh"]
environment:
WEBPACK_HOST: "0.0.0.0"
WEBPACK_PORT: "8080"
WEBPACK_POLL_MILLIS: "1000"
ports:
- 8080:8080
postgres:
image: postgres:9.6
environment:
POSTGRES_USER: "doccano"
POSTGRES_PASSWORD: "doccano"
POSTGRES_DB: "doccano"
ports:
- 5432:5432
volumes:
node_modules:
venv:
Loading…
Cancel
Save