Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4 from reactioncommerce/chore-aldeed-use-prod-ima…
Browse files Browse the repository at this point in the history
…ge-for-dc

chore: use published image for docker-compose
  • Loading branch information
aldeed authored Dec 10, 2019
2 parents cfd6d4c + 142c5dc commit f8ce00f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ imports/plugins/custom/*
coverage/*

.reaction/pluginConfig.js

docker-compose.override.yml
22 changes: 22 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM reactioncommerce/meteor:1.8.1-v1

# hadolint ignore=DL3002
USER root

# Ensure that all files will be linked in owned by node user.
# Every directory that will be listed in `volumes` section of
# docker-compose.yml needs to be pre-created and chown'd here.
# See https://github.com/docker/compose/issues/3270#issuecomment-363478501
RUN mkdir -p /usr/local/src/app/node_modules \
&& mkdir -p /usr/local/src/app/.meteor/local \
&& chown node /usr/local/src/app \
&& chown node /usr/local/src/app/node_modules \
&& chown node /usr/local/src/app/.meteor/local

WORKDIR /usr/local/src/app

USER node

ENV PATH $PATH:/usr/local/src/app/node_modules/.bin:/home/node/.meteor

CMD ["npm", "run", "start:dev"]
34 changes: 34 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This docker-compose file is used to run the project in Docker for development.
# The local files are mounted into the created container.
#
# Usage:
# ln -s docker-compose.dev.yml docker-compose.override.yml
# docker-compose up [-d]
#
# To go back to running the published image:
# rm docker-compose.override.yml

version: '3.4'

services:
identity:
# The main `docker-compose.yml` has an `image` prop. Unfortunately, when we
# add `build` prop here, it changes the meaning of that `image` prop to
# "tag the built image with this image name". This has the effect of breaking
# the app after you've run with the override and then go back to running without
# it, because now `reactioncommerce/identity:trunk` would actually be your dev image.
# To work around this issue, we specify a different tag name here, which does not
# match any of our published tags.
image: reactioncommerce/identity:local-dev
build:
context: .
dockerfile: Dockerfile-dev
command: bash -c "time /home/node/.meteor/meteor npm install --no-audit && /home/node/.meteor/meteor npm start"
volumes:
- .:/usr/local/src/app:cached
- reaction_meteor_local:/usr/local/src/app/.meteor/local
- reaction_node_modules:/usr/local/src/app/node_modules # do not link node_modules in, and persist it between dc up runs

volumes:
reaction_node_modules:
reaction_meteor_local:
31 changes: 15 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
# This docker-compose file is used to run the reaction app in docker for development
# The local files are mounted into the created container.
# This docker-compose file is used to run the project's published image
#
# Usage: docker-compose up [-d]
#
# See comment in docker-compose.dev.yml if you want to run for development.

version: '3.4'

networks:
api:
external:
name: api.reaction.localhost
auth:
external:
name: auth.reaction.localhost
reaction:
external:
name: reaction.localhost
streams:
external:
name: streams.reaction.localhost

services:

identity:
build:
context: .
target: meteor-dev
command: bash -c "time meteor npm install --no-audit && meteor npm start"
image: reactioncommerce/identity:trunk
env_file:
- ./.env
networks:
default:
api:
auth:
reaction:
streams:
ports:
- "4100:4100"
volumes:
- .:/opt/reaction/src:cached
- reaction_meteor_local:/opt/reaction/src/.meteor/local
- reaction_node_modules:/opt/reaction/src/node_modules # do not link node_modules in, and persist it between dc up runs

volumes:
reaction_node_modules:
reaction_meteor_local:

0 comments on commit f8ce00f

Please sign in to comment.