Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
moar wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Apr 24, 2017
1 parent bb31fe9 commit c313903
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 22 deletions.
37 changes: 19 additions & 18 deletions dockerfiles/billing-development.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@ RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/
# wait.sh forces our app to wait for other containers to come up before starting
# Should pull this into the repo to cache it or use the included wait scritp that comes with newer docker
# We shouldn't have to do this at all however. Our services should wait for other services until they are alive.
RUN wget -O /bin/wait.sh https://raw.githubusercontent.com/Storj/storj-sdk/master/scripts/wait.sh
RUN wget -O /usr/local/bin/wait.sh https://raw.githubusercontent.com/Storj/storj-sdk/master/scripts/wait.sh

EXPOSE 3000

RUN mkdir /billing
WORKDIR /billing
RUN mkdir /opt/billing
# Map `/opt/app` to this services project root
RUN ln -s /opt/billing /opt/app
WORKDIR /opt/billing

RUN yarn global add nodemon

COPY ./package.json /billing/package.json
COPY ./package.json /opt/billing/package.json
RUN yarn install --ignore-engines

COPY ./bin /billing/bin
COPY ./lib /billing/lib
COPY ./index.js /billing/index.js
COPY ./test /billing/test

## Add setup script which takes care of vendored modules
#ADD ./setup.sh /bin/setup.sh
#
## Pass everything through dumb-init and wait.sh first, making sure our process handles the responsibilities of PID 1 and waits for services it depends on to start before coming up.
#ENTRYPOINT ["dumb-init", "--"]
#
## The default command this container will run is the bridge, but the user can pass in their own commands which get handled by wait.sh and dumb-init.
#CMD ["/bin/bash", "/bin/wait.sh", "/bin/setup.sh", "npm run start-dev"]
CMD npm run start-dev
COPY ./bin /opt/billing/bin
COPY ./lib /opt/billing/lib
COPY ./index.js /opt/billing/index.js
COPY ./test /opt/billing/test

# Add setup script which takes care of vendored modules
ADD ./setup.sh /usr/local/bin/setup.sh

# Pass everything through dumb-init and wait.sh first, making sure our process handles the responsibilities of PID 1 and waits for services it depends on to start before coming up.
ENTRYPOINT ["dumb-init", "--"]

# The default command this container will run is the billing server, but the user can pass in their own commands which get handled by wait.sh and dumb-init.
CMD ["/bin/bash", "/usr/local/bin/wait.sh", "/usr/local/bin/setup.sh", "npm run start-dev"]
18 changes: 17 additions & 1 deletion dockerfiles/billing-importer.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
FROM node:6

# We use dumb-init since Node.js is pretty terrible at running as PID 1
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 \
&& chmod +x /usr/local/bin/dumb-init

# wait.sh forces our app to wait for other containers to come up before starting
# Should pull this into the repo to cache it or use the included wait scritp that comes with newer docker
# We shouldn't have to do this at all however. Our services should wait for other services until they are alive.
RUN wget -O /bin/wait.sh https://raw.githubusercontent.com/Storj/storj-sdk/master/scripts/wait.sh

COPY ./dockerfiles/files/billing-queries.package.json /root/package.json

WORKDIR /root
Expand All @@ -15,4 +24,11 @@ COPY ./lib/config.js /root/lib/config.js
ENV BILLING_URL http://billing
RUN chmod +x /root/bin/billing-queries.js

CMD npm run start-importer
# Add setup script which takes care of vendored modules
ADD ./setup.sh /bin/setup.sh

# Pass everything through dumb-init and wait.sh first, making sure our process handles the responsibilities of PID 1 and waits for services it depends on to start before coming up.
ENTRYPOINT ["dumb-init", "--"]

# The default command this container will run is the billing-importer, but the user can pass in their own commands which get handled by wait.sh and dumb-init.
CMD ["/bin/bash", "/bin/wait.sh", "/bin/setup.sh", "npm run start-importer"]
6 changes: 3 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cd /usr/src/app
cd /opt/app

for dir in /usr/src/vendor/* ; do
if [[ -d $dir ]]; then
echo "Manually linking $dir"
dir_name=$(basename $dir)
rm -rf /usr/src/app/node_modules/$dir_name
cp -rp $dir /usr/src/app/node_modules/$dir_name
rm -rf /opt/app/node_modules/$dir_name
cp -rp $dir /opt/app/node_modules/$dir_name
fi

echo "Rebuilding linked modules"
Expand Down

0 comments on commit c313903

Please sign in to comment.