mirror of https://github.com/doccano/doccano.git
Browse Source
Merge pull request #204 from CatalystCode/enhancement/docker-compose
Merge pull request #204 from CatalystCode/enhancement/docker-compose
Enhancement/Add Docker-Compose file for developmentpull/202/head
Hiroki Nakayama
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 128 additions and 32 deletions
Unified View
Diff Options
-
57README.md
-
10app/server/webpack.config.js
-
42docker-compose.yml
-
33tools/dev-django.sh
-
18tools/dev-webpack.sh
@ -0,0 +1,42 @@ |
|||||
|
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" |
||||
|
ports: |
||||
|
- 8000:8000 |
||||
|
|
||||
|
webpack: |
||||
|
image: node:8 |
||||
|
volumes: |
||||
|
- .:/src |
||||
|
- node_modules:/src/app/server/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: |
@ -0,0 +1,33 @@ |
|||||
|
#!/usr/bin/env bash |
||||
|
|
||||
|
set -o errexit |
||||
|
|
||||
|
root="$(dirname "$0")/.." |
||||
|
app="${root}/app" |
||||
|
venv="${root}/venv" |
||||
|
|
||||
|
if [[ ! -f "${venv}/bin/python" ]]; then |
||||
|
echo "Creating virtualenv" |
||||
|
mkdir -p "${venv}" |
||||
|
python3 -m venv "${venv}" |
||||
|
"${venv}/bin/pip" install --upgrade pip setuptools |
||||
|
fi |
||||
|
|
||||
|
echo "Installing dependencies" |
||||
|
"${venv}/bin/pip" install -r "${root}/requirements.txt" |
||||
|
|
||||
|
echo "Initializing database" |
||||
|
"${venv}/bin/python" "${app}/manage.py" wait_for_db |
||||
|
"${venv}/bin/python" "${app}/manage.py" migrate |
||||
|
|
||||
|
if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMIN_EMAIL}" ]]; then |
||||
|
"${venv}/bin/python" "${app}/manage.py" create_admin \ |
||||
|
--username "${ADMIN_USERNAME}" \ |
||||
|
--password "${ADMIN_PASSWORD}" \ |
||||
|
--email "${ADMIN_EMAIL}" \ |
||||
|
--noinput \ |
||||
|
|| true |
||||
|
fi |
||||
|
|
||||
|
echo "Starting django" |
||||
|
"${venv}/bin/python" -u "${app}/manage.py" runserver "$@" |
@ -0,0 +1,18 @@ |
|||||
|
#!/usr/bin/env bash |
||||
|
|
||||
|
set -o errexit |
||||
|
|
||||
|
root="$(dirname "$0")/.." |
||||
|
server="${root}/app/server" |
||||
|
|
||||
|
( |
||||
|
cd "${server}" |
||||
|
|
||||
|
if [[ ! -d node_modules/.bin ]]; then |
||||
|
echo "Installing dependencies" |
||||
|
npm install |
||||
|
fi |
||||
|
|
||||
|
echo "Starting webpack" |
||||
|
npm start |
||||
|
) |
Write
Preview
Loading…
Cancel
Save