Commit 81d3ede2 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Introduce a new "create-instance" command to docker-cubicweb-helper

This will help users not using onbuild images to create an instance easily.
parent 31d6a14b7ceb
......@@ -6,4 +6,4 @@ ONBUILD USER root
ONBUILD COPY . /src/
ONBUILD RUN pip install -e /src
ONBUILD USER cubicweb
ONBUILD RUN cubicweb-ctl create $(docker-cubicweb-helper get-cube) $CW_INSTANCE --automatic --no-db-create
ONBUILD RUN docker-cubicweb-helper create-instance
......@@ -120,7 +120,7 @@ For example, given you're in the source tree of `cubicweb-blog`_::
COPY . /src
RUN pip install -e /src
USER cubicweb
RUN cubicweb-ctl create blog $CW_INSTANCE --automatic --no-db-create
RUN docker-cubicweb-helper create-instance
In case of out-of-source tree or not installing from /src directory, you will
......@@ -130,8 +130,8 @@ also have to set the ``CUBE`` environment variable::
USER root
RUN pip install cubicweb-blog
USER cubicweb
RUN cubicweb-ctl create blog $CW_INSTANCE --automatic --no-db-create
ENV CUBE=blog
RUN docker-cubicweb-helper create-instance
How to run resulting images ?
-----------------------------
......
......@@ -28,6 +28,12 @@ def get_cube():
print(_get_cube())
def create_instance():
subprocess.check_call([
'cubicweb-ctl', 'create', _get_cube(), os.environ['CW_INSTANCE'],
'--automatic', '--no-db-create'])
if __name__ == '__main__':
logging.basicConfig(format='%(asctime)-15s %(message)s')
LOG.setLevel(logging.INFO)
......@@ -36,6 +42,9 @@ if __name__ == '__main__':
get_cube_parser = sub.add_parser(
'get-cube', help='get top level cubicweb cube')
get_cube_parser.set_defaults(func=get_cube)
create_instance_parser = sub.add_parser(
'create-instance', help='create a cubicweb instance')
create_instance_parser.set_defaults(func=create_instance)
args = vars(parser.parse_args())
func = args.pop('func')
sys.exit(func(**args))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment