Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPM build issue in Docker build #4317

Merged
merged 2 commits into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
##############################################################################
# meteor-dev stage - builds image for dev and used with docker-compose.yml
##############################################################################
FROM reactioncommerce/base:v4.0.2 as meteor-dev
FROM reactioncommerce/base:meteor-1.7.0.1 as meteor-dev

LABEL maintainer="Reaction Commerce <[email protected]>"

Expand All @@ -15,7 +15,11 @@ COPY --chown=node package.json $APP_SOURCE_DIR/
# Without this NPM cannot write packages into node_modules later, when running in a container.
RUN mkdir "$APP_SOURCE_DIR/node_modules" && chown node "$APP_SOURCE_DIR/node_modules"

RUN meteor npm install
# Due to an async race condition issue when installing packages with the NPM version (v5.10.0)
# in Meteor 1.7, we are switching to using the NPM version installed in the base image (v5.6.0).
# This prevents the "write after end" errors seen with this command. This will be reverted when
# Meteor updates to an NPM version without this issue.
RUN npm install

COPY --chown=node . $APP_SOURCE_DIR

Expand All @@ -32,7 +36,8 @@ RUN printf "\\n[-] Building Meteor application...\\n" \

WORKDIR $APP_BUNDLE_DIR/bundle/programs/server/

RUN meteor npm install --production
# TODO: Revert to Meteor NPM. See comment above about Meteor1.7 NPM version issue
RUN npm install --production


##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
build:
context: .
target: meteor-dev
command: bash -c "meteor npm install && reaction"
command: bash -c "npm install && reaction" #TODO; Revert to Meteor NPM. See comment in Dockerfile about Meteor1.7 NPM version issue.
depends_on:
- mongo
environment:
Expand Down