Skip to content

Instantly share code, notes, and snippets.

View martindevnow's full-sized avatar
🏠
Working from home

Benjamin Martin martindevnow

🏠
Working from home
View GitHub Profile
{
"public_identifier": "mrbenjaminmartin",
"profile_pic_url": "https://media.licdn.com/dms/image/C5603AQFGFUhEyRWz8A/profile-displayphoto-shrink_800_800/0/1556245838183?e=1693440000&v=beta&t=OZzNU-N5PP7l6mj1uMdsLFT3rDnEtclWajttLIxDu8o",
"background_cover_image_url": null,
"first_name": "Benjamin",
"last_name": "Martin",
"full_name": "Benjamin Martin",
"follower_count": null,
"occupation": "Senior Engineering Manager at ATB Ventures",
"headline": "Senior Engineering Manager at ATB Ventures",
defaults: &defaults
machine:
docker_layer_caching: true
version: 2.1
commands:
setupenv:
description: "Simple command to Setup Environment Variables"
steps:
- checkout
...,
"test:lint-unit": "npm run lint && npm run test:unit",
"comment:local": "# === Development Commands === #",
"build:dev": "docker build --target devBuild -t YOUR_DOCKER_HUB_ACCOUNT/${npm_package_name}_dev:latest -f Dockerfile.dev .",
"start:dev": "docker rm mdn_${npm_package_name}_dev_container || true && docker run --rm -it -p 8085:8085 --mount type=bind,src=`pwd`,dst=/usr/src/app -v /usr/src/app/node_modules --name mdn_${npm_package_name}_dev_container YOUR_DOCKER_HUB_ACCOUNT/${npm_package_name}_dev:latest npm run serve",
"start:unit": "docker exec -it mdn_${npm_package_name}_dev_container npm run test:unit",
"comment:prod": "# === Production Commands === #",
"build:prod": "docker build -t YOUR_DOCKER_HUB_ACCOUNT/${npm_package_name}:${TAG:=latest} -f Dockerfile .",
version: '3.2'
services:
web:
image: YOUR_DOCKER_HUB_ACCOUNT/${IMAGE_NAME}:${TAG}
tty: true
environment:
- NODE_ENV=production
command: >
http-server -p 80 /app
cypress:
FROM cypress/base:8 as e2eBuild
# Copy NPM & Install
COPY ./cypress/package.json /tmp/package.json
RUN cd /tmp && CI=true npm install
RUN CI=true /tmp/node_modules/.bin/cypress install
RUN mkdir -p /e2e && cp -a /tmp/node_modules /e2e/
WORKDIR /e2e
# Copy files for config
{
"browser": "chrome",
"pluginsFile": "tests/e2e/plugins/index.js"
}
{
"name": "e2e",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "tests"
},
"devDependencies": {
"cypress": "^3.1.2"
# Builder
FROM node:9.11.1 as builder
COPY package*.json /tmp/
RUN cd /tmp && CI=true npm install
WORKDIR /usr/src/app
COPY . /usr/src/app/
ENV NODE_ENV=production
RUN cp -a /tmp/node_modules /usr/src/app/ && npm run build
FROM node:9.11.1 as devBuild
## Set ENV Variables in the Image
ENV NODE_ENV=development
ENV PORT=8085
ENV BABEL_DISABLE_CACHE=1
## Prep node_modules
COPY package*.json /tmp/
RUN cd /tmp && npm install