Skip to content

Commit

Permalink
refactored modeler dockerfiles/docker compose files (#75)
Browse files Browse the repository at this point in the history
* removed additional dockerfilesadded docker-compose.debug file following new conventionsmoved server source to /source foldermoved thrift source to /source/thrift folder

* change back to qxapp
use build target on client for production (almost 2x faster in chrome debugger)
fixed production docker

* removed _dockerfiles folder

* updated path to thrift
  • Loading branch information
sanderegg authored May 16, 2018
1 parent f6e8a4b commit c28a29c
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ services/web/client/source-output/
services/*node_modules/
services/dy-modeling/client/source/resource/
services/dy-modeling/client/source-output/
services/dy-modeling/server/thrift/
services/dy-modeling/server/source/thrift/
31 changes: 0 additions & 31 deletions services/dy-modeling/_dockerfiles/build-npm/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions services/dy-modeling/_dockerfiles/build-qx/Dockerfile

This file was deleted.

25 changes: 25 additions & 0 deletions services/dy-modeling/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:8.9.2 AS common
ENV NPM_CONFIG_LOGLEVEL warn
# + /home/node/
# + app/source-output/
# + app/source/
# + app/*.json

WORKDIR /home/node/
RUN npm install qxcompiler

ENV PATH="/home/node/node_modules/.bin/:${PATH}"

WORKDIR /home/node/qxapp

#-----------------Development-----------------------
FROM common as development

CMD ["qx", "compile", "--watch"]

#-----------------Production----------------------
FROM common AS production

COPY source /home/node/qxapp/source
COPY *.json ./
RUN qx compile --target=build
18 changes: 18 additions & 0 deletions services/dy-modeling/docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# USAGE: docker-compose -f docker-compose.yml -f docker-compose.debug.yml ...
version: '3.4'
services:
client:
build:
target: development
image: client-dev
volumes:
- './client:/home/node/qxapp'
server:
build:
target: development
image: server-dev
ports:
- '8080:9090'
volumes:
- './server/source:/home/node/source'
- './client/source-output:/home/node/source-output'
25 changes: 0 additions & 25 deletions services/dy-modeling/docker-compose.dev.yml

This file was deleted.

16 changes: 12 additions & 4 deletions services/dy-modeling/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
version: '3'
version: '3.4'
services:
qxapp:
client:
build:
context: .
dockerfile: _dockerfiles/qxapp/node/Dockerfile
context: client
target: production
image: client-prod
server:
build:
context: server
args:
web_app_port: 9090
s4l_ip: "172.16.9.89"
s4l_port_app: 9095
s4l_port_mod: 9096
target: production
image: server-prod
ports:
- '8080:9090'
depends_on:
- client
Original file line number Diff line number Diff line change
@@ -1,52 +1,42 @@
# Compilation stage ----
FROM node:8.9.2

LABEL maintainer=pcrespov
FROM node:8.9.2 AS common

ENV NPM_CONFIG_LOGLEVEL warn

WORKDIR /home/node/
# https://www.npmjs.com/package/qxcompiler
RUN npm install qxcompiler

# TODO: why to create again? not better taking entire client??
ENV PATH="/home/node/node_modules/.bin/:${PATH}"
#RUN qx create qxapp -I --qxpath /home/node/node_modules/qooxdoo-sdk/framework/

WORKDIR /home/node/qxapp
COPY client/source source
COPY client/*.json ./
RUN qx compile


# Deployment stage -----
FROM node:8.9.2

# Web server variables
ARG web_app_port=8080
ENV SIMCORE_WEB_HOSTNAME "0.0.0.0"
ENV SIMCORE_WEB_PORT $web_app_port
ENV SIMCORE_WEB_OUTDIR /home/node/source-output
EXPOSE $web_app_port
LABEL simcore.service.settings='[{"name": "ports", "type": "int", "value": 9090}, {"name": "constraints", "type": "string", "value": ["node.platform.os == linux"]}, {"name": "env", "type": "string", "value": ["CS_S4L_HOSTNAME=xrpc-worker_%service_uuid%"]}]'

# S4L as CompServ variables
# S4L host and ports
ARG s4l_ip="0.0.0.0"
ARG s4l_port_app="9095"
ARG s4l_port_mod="9096"
ENV CS_S4L_HOSTNAME $s4l_ip
ENV CS_S4L_PORT_APP $s4l_port_app
ENV CS_S4L_PORT_MOD $s4l_port_mod

# + /home/node/ json files
# + source-output/ client source files
# + source/ server source files
WORKDIR /home/node/
COPY --from=0 /home/node/qxapp/source-output source-output
COPY server .
COPY package.json /home/node/package.json
VOLUME /home/node/source-output
#--------------------Development------------------
FROM common AS development

# TODO ensure [email protected]
RUN npm install -y \
&& npm install promise \
&& echo node $(node --version) \
&& echo npm $(npm --version)
&& npm install nodemon -g

EXPOSE $web_app_port
CMD ["nodemon", "-L", "start"]

#---------------------Production------------------
FROM common AS production
WORKDIR /home/node/
COPY --from=client-prod:latest /home/node/qxapp/build-output source-output
COPY source /home/node/source
RUN npm install -y

CMD ["npm", "start"]
ENTRYPOINT ["npm", "start"]
4 changes: 2 additions & 2 deletions services/dy-modeling/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "server-nex",
"version": "1.0.0",
"description": "boilerplate nodejs express server",
"main": "server.js",
"main": "source/server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
"start": "node source/server.js"
},
"author": "",
"license": "ISC",
Expand Down
File renamed without changes.

0 comments on commit c28a29c

Please sign in to comment.