Skip to content

Commit

Permalink
feat: readd dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
vanpho93 committed Aug 30, 2022
1 parent 0e487f3 commit 56d8a56
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ jobs:
- reaction-v6-node-modules-{{ .Branch }}
- run:
name: Test Unit
command: npm run test
command: |
npm run build:packages
npm run test
test-integration-query:
<<: *defaults
Expand All @@ -108,6 +110,7 @@ jobs:
command: |
sudo apt-get install -y mongodb
mongo --eval "rs.initiate()"
npm run build:packages
npm run test:integration:query -w=apps/reaction
test-integration-mutation:
Expand All @@ -133,6 +136,7 @@ jobs:
command: |
sudo apt-get install -y mongodb
mongo --eval "rs.initiate()"
npm run build:packages
npm run test:integration:mutation -w=apps/reaction
release:
Expand Down
16 changes: 16 additions & 0 deletions apps/reaction/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.build
.build.*
.npm
.git

# This is necessary so plugins can use git repos as npm deps.
# Leave this here unless you understand the implications.
# See this issue for details:
# https://github.com/reactioncommerce/reaction/pull/5118
!.git/modules/imports/plugins/custom

.build.log
Dockerfile
.reaction/docker/reaction.*
docs
node_modules
14 changes: 14 additions & 0 deletions apps/reaction/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dockerfile for production builds
FROM reactioncommerce/node-prod:14.18.1-v1

ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/src/app/node_modules/.bin

# The `node-prod` base image installs NPM deps with --no-scripts.
# This prevents the `sharp` lib from working because it installs the binaries
# in a post-install script. We copy their install script here and run it.
# hadolint ignore=DL3003,SC2015
RUN cd node_modules/sharp && (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

# The base image copies /src but we need to copy additional folders in this project
COPY --chown=node:node ./public ./public
COPY --chown=node:node ./plugins.json ./plugins.json
25 changes: 25 additions & 0 deletions apps/reaction/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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:
api:
image: reactioncommerce/node-dev:14.18.1-v1
ports:
- "3000:3000"
- "9229:9229"
volumes:
- .:/usr/local/src/app:cached
- api_node_modules:/usr/local/src/app/node_modules # do not link node_modules in, and persist it between dc up runs

volumes:
mongo-db4:
api_node_modules:
43 changes: 43 additions & 0 deletions apps/reaction/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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:
reaction:
external:
name: reaction.localhost

services:
api:
image: reactioncommerce/reaction:4.2.0
depends_on:
- mongo
env_file:
- ./.env
networks:
default:
reaction:
ports:
- "3000:3000"

mongo:
image: mongo:4.2.0
command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger
networks:
default:
reaction:
ports:
- "27017:27017"
volumes:
- mongo-db4:/data/db
healthcheck: # re-run rs.initiate() after startup if it failed.
test: test $$(echo "rs.status().ok || rs.initiate().ok" | mongo --quiet) -eq 1
interval: 10s
start_period: 30s

volumes:
mongo-db4:

0 comments on commit 56d8a56

Please sign in to comment.