Added new dockerfile for plugin development

This commit is contained in:
Wyatt Johnson
2017-03-29 13:37:36 -06:00
parent f80f253b98
commit 0dc105405c
5 changed files with 44 additions and 16 deletions
+15
View File
@@ -1,3 +1,18 @@
# excluded because we'll likely need to rebuild this.
node_modules
# scripts are used during development and testing, not
# production.
scripts
# documentation should not be visable in production.
docs
# static assets are rebuild in the docker container.
dist
# tests are not run in the docker container.
test
# we won't use the .git folder in production.
.git
+1 -9
View File
@@ -1,20 +1,12 @@
node_modules
npm-debug.log*
dist
!dist/coral-admin
dist/coral-admin/bundle.js
test/e2e/reports
.DS_Store
*.iml
*.swp
dump.rdb
.env
*.cfg
.idea/
coverage/
.tags
.tags1
# remove plugin folders
*.swp
plugins
plugins.json
+9 -5
View File
@@ -5,16 +5,20 @@ RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Setup the environment
ENV NODE_ENV production
ENV PATH /usr/src/app/bin:$PATH
ENV TALK_PORT 5000
EXPOSE 5000
# Install app dependencies
COPY package.json yarn.lock /usr/src/app/
RUN yarn install --production
# Bundle app source
COPY . /usr/src/app
# Install app dependencies and build static assets.
RUN yarn install && \
yarn build && \
yarn install --production && \
yarn cache clean
# Ensure the runtime of the container is in production mode.
ENV NODE_ENV production
CMD ["yarn", "start"]
+13
View File
@@ -0,0 +1,13 @@
FROM coralproject/talk:latest
# Bundle app source
ONBUILD COPY . /usr/src/app
# At this stage, we need to install the development dependancies again because
# we need to have webpack available. We then build the new dependancies and
# clear out the development dependancies again. After this we of course need to
# clear out the yarn cache, this saves quite a lot of size.
ONBUILD RUN NODE_ENV=development yarn install && \
NODE_ENV=production yarn build && \
NODE_ENV=production yarn install --production && \
yarn cache clean
+6 -2
View File
@@ -28,6 +28,7 @@ deploy_tag() {
do
echo "==> tagging $version"
docker tag coralproject/talk:latest coralproject/talk:$version
docker tag coralproject/talk:latest-onbuild coralproject/talk:$version-onbuild
done
# Push each of the tags to docker hub, including latest
@@ -35,16 +36,19 @@ deploy_tag() {
do
echo "==> pushing $version"
docker push coralproject/talk:$version
docker push coralproject/talk:$version-onbuild
done
}
deploy_latest() {
echo "==> pushing latest"
docker push coralproject/talk:latest
docker push coralproject/talk:latest-onbuild
}
# build the repo
docker build -t coralproject/talk .
# build the repo, including the onbuild tagged versions.
docker build -t coralproject/talk:latest -f Dockerfile .
docker build -t coralproject/talk:latest-onbuild -f Dockerfile.onbuild .
# deploy based on the env
if [ -n "$CIRCLE_TAG" ]