Skip to content

Instantly share code, notes, and snippets.

@iDVB
Last active January 16, 2017 14:42
Show Gist options
  • Save iDVB/c66fccf7a90586ba207865b4cb9419de to your computer and use it in GitHub Desktop.
Save iDVB/c66fccf7a90586ba207865b4cb9419de to your computer and use it in GitHub Desktop.
Codefresh Pipe
version: '1.0'
steps:
BuildingDockerDevImage:
title: Building Docker Image
type: build
image_name: idvb/eidx_dev
working_directory: ./
dockerfile: Dockerfile.builder
RunningUnitTests:
title: Running Unit Tests
image: '${{BuildingDockerDevImage}}'
commands:
- yarn install
- yarn run build -- --release
- ls -lR ./build
- cat ./build/assets.js
BuildingProdDockerImage:
title: Building Docker Image
type: build
image_name: idvb/eidx_prod
dockerfile: Dockerfile
elastic-beanstalk:
image: garland/aws-cli-docker:latest
commands:
- >-
sh -c "[ ${{CF_BRANCH}} == master ] &&
aws configure set aws_access_key_id ${{ACCESS_KEY_ID}} &&
aws configure set aws_secret_access_key ${{SECRET_ACCESS_KEY_ID}} &&
aws configure set region ${{REGION}} &&
aws elasticbeanstalk update-environment --environment-name ${{ENV_NAME}} --version-label ${{VERSION}}"
version: "2"
services:
web:
build:
dockerfile: Dockerfile.dev
context: .
volumes:
- ./:/app
ports:
- "3000:3000"
- "3001:3001"
- "3002:3002"
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:
- NODE_ENV=development
- DB_NAME=postgres
- DB_USER=postgres
- DB_PASS=postgres
- DB_SERVICE=postgres
- DB_PORT=5432
version: "2"
services:
web:
restart: always
ports:
- "80:80"
- "443:443"
environment:
- NODE_ENV=production
- DB_NAME=postgres
- DB_USER=postgres
- DB_PASS=postgres
- DB_SERVICE=postgres
- DB_PORT=5432
# nginx:
# restart: always
# build: ./nginx/
# ports:
# - "80:80"
# volumes:
# - /www/static
# volumes_from:
# - web
# links:
# - web:web
version: "2"
services:
web:
build:
dockerfile: Dockerfile
context: .
links:
- postgres:postgres
postgres:
restart: always
image: postgres:latest
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgres/data
volumes:
postgres-data:
driver: local
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
RUN ls -lR .
RUN cat ./assets.js
CMD [ "node", "server.js" ]
FROM node:7.2.1
# 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
# Global install yarn package manager
RUN npm set progress=false && \
npm install -g --progress=false yarn && \
yarn install && \
yarn run build -- --release
FROM node:7.2.1-alpine
# install all prerequisites
RUN apk add --no-cache make gcc g++ python
WORKDIR /tmp
COPY package.json /tmp
COPY yarn.lock /tmp
# Global install yarn package manager
RUN npm set progress=false && \
npm install -g --progress=false yarn && \
yarn install
WORKDIR /app
COPY ./ /app
RUN cp -a /tmp/node_modules /app/
CMD ["yarn", "start"]
EXPOSE 3000
EXPOSE 3001
EXPOSE 3002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment