Skip to content

Commit

Permalink
Merge pull request #623 from reactioncommerce/chore-use-published-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 committed Dec 10, 2019
2 parents af4456f + e5836de commit d2590c8
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ src/.next/*
build
/reports

package-lock.json
docker-compose.override.yml
6 changes: 2 additions & 4 deletions bin/start
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ IFS="$(printf "\n\t")"

cd "$(dirname "$0")/.."
yarn install
printf "Creating hydra client…"
./bin/wait-for.sh "${OAUTH2_HOST}:${OAUTH2_ADMIN_PORT}"
./bin/create-hydra-client.js
yarn dev
./bin/create-hydra-client.sh
yarn start:dev
13 changes: 13 additions & 0 deletions bin/start-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env sh

set -o errexit # always exit on error
set -o pipefail # don't ignore exit codes when piping output
# set -x # enable debugging

IFS="$(printf "\n\t")"

cd "$(dirname "$0")/.."
printf "Creating hydra client…"
./bin/wait-for.sh "${OAUTH2_HOST}:${OAUTH2_ADMIN_PORT}"
./bin/create-hydra-client.js
node .
26 changes: 26 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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:
web:
image: reactioncommerce/node-dev:10.16.3-v2
volumes:
- .:/usr/local/src/app
- web-yarn:/home/node/.cache/yarn
# Do not link in node_modules from the host
# This allows IDEs to run lint etc with native add-ons for host OS
# Without interfering with native add-ons in container
- empty_node_modules:/usr/local/src/app/node_modules

volumes:
web-yarn:
empty_node_modules:
32 changes: 15 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
# This docker-compose file is used to run the Example Storefront 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.reaction.localhost:
auth:
external:
name: auth.reaction.localhost

services:
web:
image: reactioncommerce/node-dev:10.16.3-v2
image: reactioncommerce/example-storefront:release-v3.0.0
# The only reason we need to override the command is to auto-create
# the Hydra client if it doesn't exist. In the future, we plan to
# make this logic part of the codebase, at which point this can be
# removed.
command: "./bin/start-prod.sh"
env_file:
- ./.env
networks:
api:
aliases:
- storefront
auth.reaction.localhost:
auth:
ports:
- 4000:4000
volumes:
- web-yarn:/home/node/.cache/yarn
- .:/usr/local/src/app
# Do not link in node_modules from the host
# This allows IDEs to run lint etc with native add-ons for host OS
# Without interfering with native add-ons in container
- empty_node_modules:/usr/local/src/app/node_modules

volumes:
web-yarn:
empty_node_modules:
# This volume is needed only to run the `command` above.
# When the command is removed, this volume can also be removed.
- ./bin:/usr/local/src/app/bin

0 comments on commit d2590c8

Please sign in to comment.