mirror of
https://github.com/fspc/workstand.git
synced 2025-02-23 09:13:23 -05:00
Refactor webpack into its own docker service.
This commit is contained in:
parent
8f1c2308d5
commit
07220fd7d8
@ -1,16 +1,8 @@
|
|||||||
FROM python:3.5
|
FROM python:3.5
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -y nodejs npm
|
|
||||||
RUN ln -s /usr/bin/nodejs /usr/bin/node
|
|
||||||
RUN mkdir /code
|
RUN mkdir /code
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
RUN mkdir requirements
|
RUN mkdir requirements
|
||||||
ADD ./bikeshop_project /code
|
ADD ./bikeshop_project /code
|
||||||
COPY ./requirements /code/requirements
|
COPY ./requirements /code/requirements
|
||||||
RUN pip install -r ./requirements/development.txt
|
RUN pip install -r ./requirements/development.txt
|
||||||
RUN npm install
|
|
||||||
RUN npm install -g bower
|
|
||||||
COPY ./bower.json .
|
|
||||||
RUN bower install --allow-root
|
|
||||||
EXPOSE 8000:8000
|
EXPOSE 8000:8000
|
||||||
EXPOSE 3000:3000
|
|
||||||
|
8
Dockerfile-webpack
Normal file
8
Dockerfile-webpack
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
FROM node:7.3.0
|
||||||
|
RUN mkdir /code
|
||||||
|
WORKDIR /code
|
||||||
|
RUN npm install
|
||||||
|
RUN npm install -g bower
|
||||||
|
COPY ./bower.json .
|
||||||
|
RUN bower install --allow-root
|
||||||
|
EXPOSE 3000:3000
|
@ -1,3 +1,4 @@
|
|||||||
|
import sys
|
||||||
from .base import *
|
from .base import *
|
||||||
|
|
||||||
|
|
||||||
@ -14,11 +15,14 @@ DATABASES = {
|
|||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'NAME': 'postgres',
|
'NAME': 'postgres',
|
||||||
'USER': 'postgres',
|
'USER': 'postgres',
|
||||||
'HOST': 'db',
|
'HOST': 'workstand_db_1',
|
||||||
'PORT': '5432',
|
'PORT': '5432',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if 'test' in sys.argv or 'test_coverage' in sys.argv: #Covers regular testing and django-coverage
|
||||||
|
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
||||||
|
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
'disable_existing_loggers': False,
|
'disable_existing_loggers': False,
|
||||||
@ -45,9 +49,11 @@ LOGGING = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTALLED_APPS += [
|
# INSTALLED_APPS += [
|
||||||
'debug_toolbar'
|
# 'debug_toolbar'
|
||||||
]
|
# ]
|
||||||
|
|
||||||
|
# MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware']
|
||||||
|
|
||||||
# Don't worry about IP addresses, just show the toolbar.
|
# Don't worry about IP addresses, just show the toolbar.
|
||||||
DEBUG_TOOLBAR_CONFIG = {
|
DEBUG_TOOLBAR_CONFIG = {
|
||||||
|
@ -7,13 +7,13 @@ var config = require('./webpack.base.config.js')
|
|||||||
|
|
||||||
// Use webpack dev server
|
// Use webpack dev server
|
||||||
config.entry = [
|
config.entry = [
|
||||||
'webpack-dev-server/client?http://localhost:3000',
|
'webpack-dev-server/client?http://webpack.docker:3000',
|
||||||
'webpack/hot/only-dev-server',
|
'webpack/hot/only-dev-server',
|
||||||
'./assets/js/index'
|
'./assets/js/index'
|
||||||
]
|
]
|
||||||
|
|
||||||
// override django's STATIC_URL for webpack bundles
|
// override django's STATIC_URL for webpack bundles
|
||||||
config.output.publicPath = 'http://localhost:3000/assets/bundles/'
|
config.output.publicPath = 'http://webpack.docker:3000/assets/bundles/'
|
||||||
|
|
||||||
// Add HotModuleReplacementPlugin and BundleTracker plugins
|
// Add HotModuleReplacementPlugin and BundleTracker plugins
|
||||||
config.plugins = config.plugins.concat([
|
config.plugins = config.plugins.concat([
|
||||||
|
@ -3,13 +3,29 @@ services:
|
|||||||
workstand:
|
workstand:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
command: "bash -c 'npm run watch & python manage.py runserver 0.0.0.0:8000'"
|
command: "bash -c 'python manage.py runserver 0.0.0.0:8000'"
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
- "3000:3000"
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- db
|
||||||
|
- webpack
|
||||||
|
links:
|
||||||
|
- redis
|
||||||
|
- db
|
||||||
volumes:
|
volumes:
|
||||||
- ./bikeshop_project:/code
|
- ./bikeshop_project:/code
|
||||||
redis:
|
redis:
|
||||||
restart: always
|
restart: always
|
||||||
db:
|
db:
|
||||||
restart: always
|
restart: always
|
||||||
|
webpack:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile-webpack
|
||||||
|
command: "npm run watch"
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./bikeshop_project:/code
|
||||||
|
Loading…
x
Reference in New Issue
Block a user