Skip to content

Commit

Permalink
Don't install yarn manually, it's included in the official images
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
SimenB committed Mar 2, 2017
1 parent 0e0e7d5 commit 1f0f443
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Dockerfile.onbuild
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ ONBUILD COPY package.json yarn.lock* .npmrc* npm-shrinkwrap.json* ./
# This is in one giant command to keep the image size small
# TODO: When Finnbuild uses Docker 1.13, we can use --squash, which means this won't have to be one giant command
ONBUILD RUN apk add --no-cache --virtual build-dependencies make gcc g++ python git && \
npm install --loglevel warn --global yarn && \
# This script does `yarn install` if a `yarn.lock` file is present, otherwise `npm install`
install-dependencies.sh && \
npm uninstall --loglevel warn --global yarn && npm uninstall --loglevel warn --global npm && \
rm /usr/local/bin/yarn && npm uninstall --loglevel warn --global npm && \
apk del build-dependencies

ONBUILD COPY . .
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ ENV NODE_ENV test
# Install dependencies for native builds and yarn
RUN apk add --no-cache make gcc g++ python git

RUN npm install --global --loglevel warn yarn

CMD ["npm", "test"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ COPY package.json yarn.lock* .npmrc* npm-shrinkwrap.json* ./
# This is in one giant command to keep the image size small
# NOTE: `install-dependencies.sh` only installs production dependencies, make sure you do transpiling/bundling outside of the image
RUN apk add --no-cache --virtual build-dependencies make gcc g++ python git && \
npm install --global yarn && \
# This script does `yarn install` if a `yarn.lock` file is present, otherwise `npm install`
install-dependencies.sh && \
npm uninstall --global yarn && npm uninstall --global npm && \
rm /usr/local/bin/yarn && npm uninstall --global npm && \
apk del build-dependencies

COPY . .
Expand Down Expand Up @@ -73,7 +72,8 @@ Changes might include:

## Testing

The normal docker image shouldn't be used for tests, use `containers.schibsted.io/finntech/node:test-<version>` or `containers.schibsted.io/finntech/node:test-onbuild-<version>`.
The normal docker image shouldn't be used for tests, use `containers.schibsted.io/finntech/node:test-<version>` or
`containers.schibsted.io/finntech/node:test-onbuild-<version>`.

Dockerfile.test:
```Dockerfile
Expand Down

0 comments on commit 1f0f443

Please sign in to comment.