build(cp-frontend): build assets on runtime

This commit is contained in:
Sérgio Ramos 2017-06-20 15:45:50 +01:00
parent d4bedc0515
commit 76ee6b66ed
6 changed files with 14 additions and 18 deletions

View File

@ -66,6 +66,8 @@ cp-frontend:
environment: environment:
- CONSUL_AGENT=1 - CONSUL_AGENT=1
- PORT=3069 - PORT=3069
- REACT_APP_GQL_HOSTNAME=gql-mock-server-$CIRCLE_BRANCH.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone
- REACT_APP_GQL_PORT=3000
ports: ports:
- 3069 - 3069

View File

@ -6,13 +6,8 @@ RUN yarn add lerna@^2.0.0-rc.5 serve \
&& ./node_modules/.bin/lerna clean --yes --scope joyent-cp-frontend --include-filtered-dependencies \ && ./node_modules/.bin/lerna clean --yes --scope joyent-cp-frontend --include-filtered-dependencies \
&& ./node_modules/.bin/lerna bootstrap --scope joyent-cp-frontend --include-filtered-dependencies && ./node_modules/.bin/lerna bootstrap --scope joyent-cp-frontend --include-filtered-dependencies
WORKDIR /opt/app/packages/cp-frontend
COPY packages/cp-frontend/etc/containerpilot.json5 ${CONTAINERPILOT} COPY packages/cp-frontend/etc/containerpilot.json5 ${CONTAINERPILOT}
WORKDIR /opt/app/packages/cp-frontend
RUN yarn run build
ARG CIRCLE_BRANCH
ENV REACT_APP_GQL_HOSTNAME gql-mock-server-$CIRCLE_BRANCH.svc.f4b20699-b323-4452-9091-977895896da6.eu-ams-1.triton.zone
EXPOSE 3069 EXPOSE 3069
CMD ["/bin/containerpilot"] CMD ["/bin/containerpilot"]

View File

@ -1,10 +1,18 @@
{ {
consul: 'localhost:8500', consul: 'localhost:8500',
jobs: [ jobs: [
{
name: 'build',
exec: 'yarn run build'
},
{ {
name: 'cp-frontend', name: 'cp-frontend',
port: {{.PORT}}, port: {{.PORT}},
exec: '../../node_modules/.bin/serve --single build --port {{.PORT}}', exec: '../../node_modules/.bin/serve --single build --port {{.PORT}}',
when: {
source: 'build',
once: 'exitSuccess'
},
health: { health: {
exec: '/usr/bin/curl -o /dev/null --fail -s http://localhost:{{.PORT}}', exec: '/usr/bin/curl -o /dev/null --fail -s http://localhost:{{.PORT}}',
interval: 2, interval: 2,

View File

@ -6,12 +6,8 @@ RUN yarn add lerna@^2.0.0-rc.5 serve \
&& ./node_modules/.bin/lerna clean --yes --scope joyent-cp-gql-mock-server --include-filtered-dependencies \ && ./node_modules/.bin/lerna clean --yes --scope joyent-cp-gql-mock-server --include-filtered-dependencies \
&& ./node_modules/.bin/lerna bootstrap --scope joyent-cp-gql-mock-server --include-filtered-dependencies && ./node_modules/.bin/lerna bootstrap --scope joyent-cp-gql-mock-server --include-filtered-dependencies
WORKDIR /opt/app/packages/cp-gql-mock-server
COPY packages/cp-gql-mock-server/etc/containerpilot.json5 ${CONTAINERPILOT} COPY packages/cp-gql-mock-server/etc/containerpilot.json5 ${CONTAINERPILOT}
COPY packages/cp-gql-mock-server/bin /bin WORKDIR /opt/app/packages/cp-gql-mock-server
ARG CIRCLE_BRANCH
EXPOSE 3000 EXPOSE 3000
CMD ["/bin/containerpilot"] CMD ["/bin/containerpilot"]

View File

@ -11,10 +11,7 @@ RUN yarn add lerna@^2.0.0-rc.5 \
&& ./node_modules/.bin/lerna clean --yes --scope portal-api --include-filtered-dependencies \ && ./node_modules/.bin/lerna clean --yes --scope portal-api --include-filtered-dependencies \
&& ./node_modules/.bin/lerna bootstrap --scope portal-api --include-filtered-dependencies && ./node_modules/.bin/lerna bootstrap --scope portal-api --include-filtered-dependencies
COPY packages/portal-api/etc/containerpilot.json5 ${CONTAINERPILOT}
WORKDIR /opt/app/packages/portal-api WORKDIR /opt/app/packages/portal-api
COPY packages/portal-api/etc/containerpilot.json5 ${CONTAINERPILOT}
ARG CIRCLE_BRANCH
CMD ["/bin/containerpilot"] CMD ["/bin/containerpilot"]

View File

@ -6,12 +6,10 @@ RUN yarn add lerna@^2.0.0-rc.5 serve \
&& ./node_modules/.bin/lerna clean --yes --scope joyent-ui-toolkit --include-filtered-dependencies \ && ./node_modules/.bin/lerna clean --yes --scope joyent-ui-toolkit --include-filtered-dependencies \
&& ./node_modules/.bin/lerna bootstrap --scope joyent-ui-toolkit --include-filtered-dependencies && ./node_modules/.bin/lerna bootstrap --scope joyent-ui-toolkit --include-filtered-dependencies
WORKDIR /opt/app/packages/ui-toolkit
COPY packages/ui-toolkit/etc/containerpilot.json5 ${CONTAINERPILOT} COPY packages/ui-toolkit/etc/containerpilot.json5 ${CONTAINERPILOT}
WORKDIR /opt/app/packages/ui-toolkit
RUN yarn run styleguide:build RUN yarn run styleguide:build
ARG CIRCLE_BRANCH
EXPOSE 6060 EXPOSE 6060
CMD ["/bin/containerpilot"] CMD ["/bin/containerpilot"]