Skip to content

Instantly share code, notes, and snippets.

@iDVB
Last active January 13, 2017 19:30
Show Gist options
  • Save iDVB/6608b8504b7505bc67e0c3f0327ef825 to your computer and use it in GitHub Desktop.
Save iDVB/6608b8504b7505bc67e0c3f0327ef825 to your computer and use it in GitHub Desktop.
ReactJS App Compose files
build:
version: 2016-03-14 # version of the build schema.
steps:
builder:
name: builder
dockerfile: Dockerfile.builder
artifacts:
- /usr/src/app/build:./build
deployment:
name: ironmountain
depends_on:
- builder
dockerfile: Dockerfile
version: "2"
services:
web:
build:
dockerfile: Dockerfile.dev
context: .
volumes:
- ./:/app
ports:
- "3000:3000"
- "3001:3001"
- "3002:3002"
links:
- postgres:postgres
command: >
sh -c '
if test -d node_modules;
then
echo node_modules_exists ;
else
cp -a /tmp/node_modules /app;
fi &&
yarn install &&
yarn start
'
environment:
- DB_NAME=postgres
- DB_USER=postgres
- DB_PASS=postgres
- DB_SERVICE=postgres
- DB_PORT=5432
postgres:
restart: always
image: postgres:latest
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgres/data
volumes:
postgres-data:
driver: local
# nginx:
# restart: always
# build: ./nginx/
# ports:
# - "80:80"
# volumes:
# - /www/static
# volumes_from:
# - web
# links:
# - web:web
FROM node:7.2.1-alpine
# Copy application files
COPY ./build /usr/src/app
WORKDIR /usr/src/app
# Install Node.js dependencies
RUN npm install --production --silent
CMD [ "node", "server.js" ]
FROM node:7.2.1-alpine
# Create directory
RUN mkdir -p /usr/src/app
# Copy application files
COPY . /usr/src/app
WORKDIR /usr/src/app
# install all prerequisites
RUN apk add --no-cache make gcc g++ python bash
# Global install yarn package manager
RUN npm set progress=false && \
npm install -g --progress=false yarn && \
yarn install && \
yarn run build -- --release
---
docker:
servers:
- server:
unique_name: Bobcat
vendor: aws
key_name: Default
region: us-east-1
size: c3.large
configuration:
has_deploy_hooks: false
docker_version: 1.12.5
weave_version: 1.8.2
---
services:
eidx:
git_url: git@github.com:iDVB/eidx
git_branch: codeship
use_habitus: true
use_habitus_step: deployment
@iDVB
Copy link
Author

iDVB commented Jan 4, 2017

One of the things that stumped me about this stack is that the Dockerfile->Container above installs build tools into it that are needed during dev but likely would not want on a production server.

Of note, we use this stack locally during development which allows developers to edit code in realtime from their host machine and upon save it triggers react-hot-reloading on the web container. Again.... something needed in dev but definitely not needed in prod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment