From 8c464f9c2ac3cc111e9b768bd0649ab56c73e809 Mon Sep 17 00:00:00 2001 From: Perry Taylor Date: Tue, 4 Apr 2017 08:08:13 -0400 Subject: [PATCH 1/5] Add a docker ignore --- .dockerignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d199af9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git +.gitignore +node_modules +npm-debug.log \ No newline at end of file From 8ecedd1968c14dce22539bef4473b2020f0af485 Mon Sep 17 00:00:00 2001 From: Perry Taylor Date: Tue, 4 Apr 2017 09:08:24 -0400 Subject: [PATCH 2/5] First swing at a docker file --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ab40ebe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM mhart/alpine-node:6 + +MAINTAINER Oz Haven (@therebelrobot) + +# make is needed for running docker locally +RUN apk update && apk add --no-cache make python g++ + +COPY ./distributions/suite ./suite +WORKDIR ./suite + +# More deps for working locally +RUN npm prune --production +RUN npm rebuild --production +RUN npm install +RUN npm install --global yarn + +EXPOSE 5555 + +ENV PORT 5555 +ENV NODE_ENV production + +CMD ["make", "start"] From 5853c3a2744a421faaecfdffa07252c51b2bf033 Mon Sep 17 00:00:00 2001 From: Perry Taylor Date: Tue, 4 Apr 2017 10:43:02 -0400 Subject: [PATCH 3/5] fix yarn install in dockerfile --- Dockerfile | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ab40ebe..d8c6a58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,21 +2,40 @@ FROM mhart/alpine-node:6 MAINTAINER Oz Haven (@therebelrobot) +ENV YARN_VERSION 0.21.3 + +ADD https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v${YARN_VERSION}.tar.gz /opt/yarn.tar.gz + # make is needed for running docker locally RUN apk update && apk add --no-cache make python g++ COPY ./distributions/suite ./suite -WORKDIR ./suite +COPY ./core ./core +COPY ./themes/c4sf/public ./public +COPY ./themes/c4sf/admin ./admin # More deps for working locally RUN npm prune --production RUN npm rebuild --production RUN npm install -RUN npm install --global yarn + +WORKDIR ./core +RUN make install +RUN make link + +WORKDIR ./admin +RUN make install +RUN make link + +WORKDIR ./public +RUN make install +RUN make link + +WORKDIR ./suite EXPOSE 5555 ENV PORT 5555 ENV NODE_ENV production -CMD ["make", "start"] +RUN make install From 338b1d4a51841a881ec6b794d31e048778ed18df Mon Sep 17 00:00:00 2001 From: Perry Taylor Date: Tue, 4 Apr 2017 10:53:35 -0400 Subject: [PATCH 4/5] actually install yarn --- Dockerfile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d8c6a58..e6bae28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,23 +2,26 @@ FROM mhart/alpine-node:6 MAINTAINER Oz Haven (@therebelrobot) +# download yarn ENV YARN_VERSION 0.21.3 - ADD https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v${YARN_VERSION}.tar.gz /opt/yarn.tar.gz # make is needed for running docker locally RUN apk update && apk add --no-cache make python g++ +# install yarn +RUN yarnDirectory=/opt/yarn && \ + mkdir -p "$yarnDirectory" && \ + tar -xzf /opt/yarn.tar.gz -C "$yarnDirectory" && \ + ln -s "$yarnDirectory/dist/bin/yarn" /usr/local/bin/ && \ + rm /opt/yarn.tar.gz + +# copy BrigadeHub projects COPY ./distributions/suite ./suite COPY ./core ./core COPY ./themes/c4sf/public ./public COPY ./themes/c4sf/admin ./admin -# More deps for working locally -RUN npm prune --production -RUN npm rebuild --production -RUN npm install - WORKDIR ./core RUN make install RUN make link @@ -36,6 +39,6 @@ WORKDIR ./suite EXPOSE 5555 ENV PORT 5555 -ENV NODE_ENV production +ENV NODE_ENV development RUN make install From 240e4c4c59971ff16a7082a216487fde96419fd4 Mon Sep 17 00:00:00 2001 From: Perry Taylor Date: Tue, 4 Apr 2017 11:36:42 -0400 Subject: [PATCH 5/5] Try to set directories to make other installs work. --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index e6bae28..6f1e405 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,19 +22,21 @@ COPY ./core ./core COPY ./themes/c4sf/public ./public COPY ./themes/c4sf/admin ./admin -WORKDIR ./core +ENV DIRPATH ./ + +WORKDIR $DIRPATH/core RUN make install RUN make link -WORKDIR ./admin +WORKDIR $DIRPATH/admin RUN make install RUN make link -WORKDIR ./public +WORKDIR $DIRPATH/public RUN make install RUN make link -WORKDIR ./suite +WORKDIR $DIRPATH/suite EXPOSE 5555