Skip to content

Commit

Permalink
Merge branch 'master' into feat-aldeed-payment-checkout-components
Browse files Browse the repository at this point in the history
  • Loading branch information
aldeed committed Jan 11, 2019
2 parents bc51f73 + 0acb38e commit ec655f1
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 22 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ jobs:
--env-file docker-cache/.env \
-e "SNYK_TOKEN=$SNYK_TOKEN" \
--name reactionapp_web_1 \
-w /usr/local/src \
"$DOCKER_REPOSITORY:$CIRCLE_SHA1" \
sh -c "cp reaction-app/package.json ./ && cp reaction-app/.snyk ./ && snyk test"
sh -c "snyk test"
publish-npm-package:
docker:
Expand Down
1 change: 0 additions & 1 deletion .reaction/yarnrc-docker.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ yarn-offline-mirror-pruning true

--install.cache-folder /home/node/.cache/yarn
--install.ignore-scripts true
--install.modules-folder /usr/local/src/node_modules
--install.prefer-offline true
37 changes: 21 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ARG GIT_SHA1
ARG LICENSE

ENV APP_SOURCE_DIR=/usr/local/src/reaction-app \
PATH=$PATH:/usr/local/src/node_modules/.bin
PATH=$PATH:/usr/local/src/reaction-app/node_modules/.bin

LABEL maintainer="Reaction Commerce <[email protected]>" \
com.reactioncommerce.build-date=$BUILD_DATE \
Expand Down Expand Up @@ -57,11 +57,18 @@ LABEL maintainer="Reaction Commerce <[email protected]>" \
# Because Docker Compose uses a volume for node_modules and volumes are owned
# by root by default, we have to initially create node_modules here with correct owner.
# Without this Yarn cannot write packages into node_modules later, when running in a container.
RUN mkdir -p "/usr/local/src/node_modules" && chown node "/usr/local/src" && chown node "/usr/local/src/node_modules"
RUN mkdir -p "/usr/local/src/reaction-app/node_modules" && chown node "/usr/local/src/reaction-app" && chown node "/usr/local/src/reaction-app/node_modules"
RUN mkdir -p "/usr/local/src/reaction-app/node_modules"
RUN mkdir -p "/usr/local/src/reaction-app/package/node_modules"
RUN chown node "/usr/local/src"
RUN chown node "/usr/local/src/reaction-app"
RUN chown node "/usr/local/src/reaction-app/node_modules"
RUN chown node "/usr/local/src/reaction-app/package/node_modules"

WORKDIR $APP_SOURCE_DIR/..
COPY --chown=node package.json yarn.lock $APP_SOURCE_DIR/../
WORKDIR $APP_SOURCE_DIR

# Note that the two node_modules directories will not be copied during
# this due to being listed in the `.dockerignore` file.
COPY --chown=node . $APP_SOURCE_DIR

# Build the dependencies into the Docker image in a cacheable way. Dependencies
# are only rebuilt when package.json or yarn.lock is modified.
Expand All @@ -75,13 +82,20 @@ RUN set -ex; \
--frozen-lockfile \
--ignore-scripts \
--no-cache; \
cd package && yarn install \
--frozen-lockfile \
--ignore-scripts \
--no-cache; \
elif [ "$BUILD_ENV" = "test" ]; then \
yarn install \
--frozen-lockfile \
--ignore-scripts \
--no-cache; \
fi; \
rm package.json yarn.lock
cd package && yarn install \
--frozen-lockfile \
--ignore-scripts \
--no-cache; \
fi;

# For development, we will yarn install on each container start.
# This ensures that we use our Docker development .yarnrc config
Expand All @@ -95,15 +109,6 @@ RUN set -ex; \
# we already ran yarn install above, it doesn't matter.
COPY --chown=node ./.reaction/yarnrc-docker.template /home/node/.yarnrc

WORKDIR $APP_SOURCE_DIR
COPY --chown=node . $APP_SOURCE_DIR

RUN set -ex; \
cd package && yarn install \
--frozen-lockfile \
--ignore-scripts \
--no-cache;

# Important: Make sure we're the "node" user before we begin doing things because
# our tools use "/home/node" as the HOME dir.
USER node
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ services:
- $HOME/.cache/yarn-offline-mirror:/home/node/.cache/yarn-offline-mirror
- web-yarn:/home/node/.cache/yarn
- .:/usr/local/src/reaction-app # link everything from the root folder on the host machine into the container
- empty_node_modules:/usr/local/src/reaction-app/node_modules # except do not link the host node_modules in because it will override the container node_modules
- node_modules:/usr/local/src/node_modules # persist the node_modules that is used, which is up one folder level in the container
- node_modules:/usr/local/src/reaction-app/node_modules # except do not link the host /node_modules in because it will override the container node_modules
- package_node_modules:/usr/local/src/reaction-app/package/node_modules # except do not link the host /package/node_modules in because it will override the container node_modules

volumes:
web-yarn:
empty_node_modules:
node_modules:
package_node_modules:
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Running and Developing Locally](./developing.md)
- [Repo Structure](./repo-structure.md)
- [Style Guide Development](./style-guide-development.md)
- [Contributing](./contributing.md)

### Editor Extensions

Expand Down
52 changes: 52 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributing

We're thrilled that you want to contribute to the Reaction Component Library!

Before submitting your first contribution, please consult the [official guide on contributing to the Reaction code base](https://docs.reactioncommerce.com/docs/contributing-to-reaction) first. The sections below are currently specific to the Reaction Component Library and should be considered in addition to the official guide.

# Signing your Commits

Contributing to the Reaction Component Library requires signing your work by way of signed Git commits.

The Reaction Component Library uses the Apache 2.0 license to allow our community and customers to use it in whichever way they please. It also helps foster open contributions.

As a contributor, we want to make sure that you understand your rights as the copyright holder. We also want to make sure that contributions done on behalf of companies (i.e. by their employees) are submitted with the acknowledgement that the contributor (employee) isn't the copyright holder (employer).

The Reaction Components Library is using a Developer Certificate of Origin (DCO), by way of signed commits, to help contributors acknowledge that they're aware of their rights, and that they have the authority to submit their contributions either on their or on their employer's behalf.

To sign off on the DCO for your commits, use the command `git commit -s` which adds a line to every commit that looks like this:

`Signed-Off-By: Jane Doe <[email protected]>`

We do ask that you use your full name and a valid email address in this process.

The DCO signoff is attached to every single commit, thereby stating that the committer agrees to the DCO as shown below or on <https://developercertificate.org/>.

```
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the
best of my knowledge, is covered under an appropriate open
source license and I have the right under that license to
submit that work with modifications, whether created in whole
or in part by me, under the same open source license (unless
I am permitted to submit under a different license), as
Indicated in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including
all personal information I submit with it, including my
sign-off) is maintained indefinitely and may be redistributed
consistent with this project or the open source license(s)
involved.
```

0 comments on commit ec655f1

Please sign in to comment.