-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): init docker & docker compose ✨
- Loading branch information
1 parent
6b500c0
commit d28e047
Showing
4 changed files
with
56 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,17 @@ | ||
# Build: | ||
# docker build -t meanjs/mean . | ||
# | ||
# Run: | ||
# docker run -it meanjs/mean | ||
# | ||
# Compose: | ||
# docker-compose up -d | ||
FROM node:lts-slim | ||
|
||
FROM ubuntu:latest | ||
MAINTAINER WAOS Node | ||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# 80 = HTTP, 443 = HTTPS, 3000 = WAOS Node server, 35729 = livereload, 8080 = node-inspector | ||
EXPOSE 80 443 3000 35729 8080 | ||
|
||
# Set development environment as default | ||
ENV NODE_ENV development | ||
|
||
# Install Utilities | ||
RUN apt-get update -q \ | ||
&& apt-get install -yqq \ | ||
curl \ | ||
git \ | ||
ssh \ | ||
gcc \ | ||
make \ | ||
build-essential \ | ||
libkrb5-dev \ | ||
sudo \ | ||
apt-utils \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# Install nodejs | ||
RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | ||
RUN sudo apt-get install -yq nodejs \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
# Install app dependencies | ||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
# Install WAOS Node Prerequisites | ||
RUN npm install --quiet -g gulp bower yo mocha karma-cli pm2 && npm cache clean | ||
# Bundle app source | ||
COPY . . | ||
|
||
RUN mkdir -p /opt/waosNode/public/lib | ||
WORKDIR /opt/waosNode | ||
|
||
# Copies the local package.json file to the container | ||
# and utilities docker container cache to not needing to rebuild | ||
# and install node_modules/ everytime we build the docker, but only | ||
# when the local package.json file changes. | ||
# Install npm packages | ||
COPY package.json /opt/waosNode/package.json | ||
RUN npm install --quiet && npm cache clean | ||
|
||
# Install bower packages | ||
COPY bower.json /opt/waosNode/bower.json | ||
COPY .bowerrc /opt/waosNode/.bowerrc | ||
RUN bower install --quiet --allow-root --config.interactive=false | ||
|
||
COPY . /opt/waosNode | ||
# Expose | ||
EXPOSE 80 443 3000 35729 8080 | ||
|
||
# Run WAOS Node server | ||
CMD npm install && npm start | ||
# Command to run the executable | ||
CMD [ "node", "server.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,36 @@ | ||
version: '2' | ||
version: '3' | ||
|
||
services: | ||
web: | ||
|
||
waosnode: | ||
container_name: waosnode | ||
image: waosnode:latest | ||
restart: always | ||
build: . | ||
container_name: meanjs | ||
ports: | ||
- "3000:3000" | ||
- "5858:5858" | ||
- "8080:8080" | ||
- "35729:35729" | ||
environment: | ||
- NODE_ENV=development | ||
- DB_1_PORT_27017_TCP_ADDR=db | ||
depends_on: | ||
- db | ||
volumes_from: | ||
- web-data | ||
web-data: | ||
build: . | ||
entrypoint: /bin/true | ||
- 3000:3000 | ||
volumes: | ||
- ./:/opt/mean.js | ||
- /opt/mean.js/node_modules | ||
- /opt/mean.js/public | ||
- /opt/mean.js/uploads | ||
db: | ||
image: mongo:3.2 | ||
- waosnode:/data | ||
networks: | ||
- mongo | ||
depends_on: | ||
- mongo | ||
environment: | ||
- "WAOS_NODE_db_uri=mongodb://mongo:27017/WaosNodeDev" | ||
- "WAOS_NODE_host=0.0.0.0" | ||
|
||
mongo: | ||
container_name: mongo | ||
image: mongo:latest | ||
restart: always | ||
ports: | ||
- "27017:27017" | ||
volumes_from: | ||
- db-data | ||
db-data: | ||
image: mongo:3.2 | ||
volumes: | ||
- /data/db | ||
- /var/lib/mongodb | ||
- /var/log/mongodb | ||
entrypoint: /bin/true | ||
- mongo:/data | ||
networks: | ||
- mongo | ||
|
||
networks: | ||
mongo: | ||
driver: bridge | ||
|
||
volumes: | ||
waosnode: | ||
mongo: |