Skip to content

Instantly share code, notes, and snippets.

@hernandev
Created August 19, 2016 19:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hernandev/5fa6a9c25b71c233998a8a8fc900ef9b to your computer and use it in GitHub Desktop.
Save hernandev/5fa6a9c25b71c233998a8a8fc900ef9b to your computer and use it in GitHub Desktop.
Ambientum VueJS Development
version: '2'
services:
# Web server - For live reload and development
# This environment can be used to run npm and node
# commands as well
dev:
image: ambientum/node:6
command: node build/dev-server.js
volumes:
- .:/var/www/app
ports:
- 8080:8080
# Testing dist on a "real" webserver
production-server:
image: nginx:stable-alpine
volumes:
- ./dist:/usr/share/nginx/html
ports:
- 9090:80
#Using a existing project, you can just add this docker-compose on your project root
#To enable the development and production-preview servers
# USAGE
# 1) Running a Command inside the docker containers
# - Sintax:
docker-compose run dev [command]
# - Example:
docker-compose run dev npm run build
# If you want to use npm like it is locally installed
# Just alias is, For bash and ZSH
alias npm="docker-compose run dev npm"
# For Fish Shell
alias npm 'docker-compose run dev npm'
# and use it normally
npm [arguments]
# If you want to run npm or vue-cli to create a project, it means you don't have
# a place to put your docker-compose-.yml yet
# you can alias a one time container to do the job for you
# Using node binary insde a container
alias node="docker run -it --rm -v (pwd):/var/www/app ambientum/node:6 node"
# Using npm inside a container
alias npm="docker run -it --rm -v (pwd):/var/www/app ambientum/node:6 npm"
# Using vue-cli inside a container
alias vue="docker run -it --rm -v (pwd):/var/www/app ambientum/vue-cli:2.1 vue"
# on the vue-cli example, you can choose versions 1.2, 2.0 and 2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment