Skip to content

Commit

Permalink
Mutli-stage docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
binoculars committed Nov 1, 2017
1 parent 1552a05 commit f48d14f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 58 deletions.
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--ignore-engines true
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
- Use yarn --frozen-lockfile instead of --pure-lockfile
- Update Dockerfiles
- Use COS ember-base image and multi-stage build
- Notify DevOps prior to merging into master to update Jenkins


## [0.115.0] - 2017-10-27
Expand Down
66 changes: 20 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,30 @@
FROM node:8

RUN apt-get update \
&& apt-get install -y \
git \
# Next 2 needed for yarn
apt-transport-https \
ca-certificates \
# watchman
build-essential \
automake \
autoconf \
python-dev \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y \
yarn \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

ENV WATCHMAN_VERSION 4.9.0
RUN cd /tmp \
&& git clone https://github.com/facebook/watchman.git \
&& cd watchman \
&& git checkout v$WATCHMAN_VERSION \
&& ./autogen.sh \
&& ./configure --enable-statedir=/tmp \
&& make \
&& make install \
&& mv watchman /usr/local/bin/watchman \
&& rm -Rf /tmp/watchman
### App code
FROM quay.io/centerforopenscience/ember-base AS app

RUN mkdir -p /code
WORKDIR /code

COPY ./package.json ./yarn.lock /code/
RUN yarn --frozen-lockfile --ignore-engines
COPY ./package.json ./yarn.lock ./.yarnrc ./
RUN yarn --frozen-lockfile

COPY ./.bowerrc /code/.bowerrc
COPY ./bower.json /code/bower.json
COPY ./.bowerrc ./bower.json ./
RUN ./node_modules/.bin/bower install --allow-root --config.interactive=false

COPY ./ /code/
COPY ./ ./

ARG GIT_COMMIT=
ENV GIT_COMMIT ${GIT_COMMIT}

RUN ./node_modules/.bin/ember build --env ${APP_ENV}
RUN yarn build --environemnt=production

### Dist
FROM node:8-alpine AS dist

RUN mkdir -p /code
WORKDIR /code

COPY --from=app /code/dist /code/dist

### Dev
FROM app AS dev

EXPOSE 4200

CMD ["yarn", "start"]
11 changes: 0 additions & 11 deletions Dockerfile-alpine

This file was deleted.

0 comments on commit f48d14f

Please sign in to comment.