Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 8 additions & 108 deletions scripts/seed-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
'use strict';

require('loadenv')();

var fs = require('fs');
var Context = require('models/mongo/context');
var ContextVersion = require('models/mongo/context-version');
var InfraCodeVersion = require('models/mongo/infra-code-version');
Expand Down Expand Up @@ -248,127 +250,25 @@ function newCV (context, icv, cb) {
var sources = [{
name: 'NodeJs',
isTemplate: true,
body: '# Full list of versions available here: https://registry.hub.docker.com/_/node/tags/manage/\n' +
'FROM node:<nodejs-version>\n' +
'\n' +
'# Open up ports on the server\n' +
'EXPOSE <user-specified-ports>\n' +
'\n' +
'# Add repository files to server\n' +
'ADD ./<repo-name> /<repo-name>\n' +
'WORKDIR /<repo-name>\n' +
'\n' +
'# Install dependencies\n' +
'RUN apt-get update \n' +
'<add-dependencies>\n' +
'\n' +
'RUN npm install\n' +
'\n' +
'# Command to start the app\n' +
'CMD <start-command>\n'
body: fs.readFileSync(__dirname + '/sourceDockerFiles/nodejs').toString()
}, {
name: 'Rails',
isTemplate: true,
body: 'FROM ruby:<ruby-version>\n' +
'# Open up ports on the server\n' +
'EXPOSE <user-specified-ports>\n' +
'\n' +
'# Install Rails (and its dependencies)\n' +
'RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*\n' +
'\n' +
'\n' +
'# see http://guides.rubyonrails.org/command_line.html#rails-dbconsole\n' +
'RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/*\n' +
'\n' +
'# Specify the version of Rails to install\n' +
'ENV RAILS_VERSION <rails-version>\n' +
'RUN gem install rails --version "$RAILS_VERSION"\n' +
'\n' +
'# Add repository files to server\n' +
'ADD ./<repo-name> /<repo-name>\n' +
'WORKDIR /<repo-name>\n' +
'\n' +
'# Install dependencies\n' +
'RUN apt-get update \n' +
'<add-dependencies>\n' +
'\n' +
'RUN bundle install\n' +
'\n' +
'# Setup and seed database\n' +
'RUN rake db:create db:migrate\n' +
'\n' +
'# Command to start the app\n' +
'CMD <start-command>\n'
body: fs.readFileSync(__dirname + '/sourceDockerFiles/rails').toString()
}, {
name: 'Ruby',
isTemplate: true,
body: 'FROM ruby:<ruby-version>\n' +
'# Open up ports on the server\n' +
'EXPOSE <user-specified-ports>\n' +
'\n' +
'# Install Rails (and its dependencies)\n' +
'RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*\n' +
'\n' +
'\n' +
'# see http://guides.rubyonrails.org/command_line.html#rails-dbconsole\n' +
'RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/*\n' +
'\n' +
'# Add repository files to server\n' +
'ADD ./<repo-name> /<repo-name>\n' +
'WORKDIR /<repo-name>\n' +
'\n' +
'# Install dependencies\n' +
'RUN apt-get update \n' +
'<add-dependencies>\n' +
'\n' +
'RUN bundle install\n' +
'\n' +
'# Command to start the app\n' +
'CMD <start-command>\n'
body: fs.readFileSync(__dirname + '/sourceDockerFiles/ruby').toString()
}, {
name: 'Python',
isTemplate: true,
body: 'FROM python:<python-version>\n' +
'\n' +
'# Open up ports on the server\n' +
'EXPOSE <user-specified-ports>\n' +
'\n' +
'# Install environmental dependencies\n' +
'RUN apt-get -y -q update && apt-get install -y -q libmysqlclient-dev postgresql-server-dev-9.1\n' +
'\n' +
'# Add the repository to the /home folder\n' +
'ADD ./<repo-name> /home/\n' +
'WORKDIR /home\n' +
'\n' +
'# Install dependencies\n' +
'RUN pip install -r /home/requirements.txt\n' +
'\n' +
'RUN apt-get update \n' +
'<add-dependencies>\n' +
'\n' +
'# Command to start the app\n' +
'CMD <start-command>\n'
body: fs.readFileSync(__dirname + '/sourceDockerFiles/python').toString()
}, {
name: 'PostgreSQL',
body: '# Full list of versions available here: https://registry.hub.docker.com/_/postgres/tags/manage/\n'+
'FROM postgres:9.4\n' +
'\n' +
'# Set recommended environment variables\n' +
'ENV POSTGRES_USER postgres\n' +
'ENV POSTGRES_PASSWORD postgres\n' +
'\n' +
'# Open port 5432 on the server\n' +
'EXPOSE 5432\n'
body: fs.readFileSync(__dirname + '/sourceDockerFiles/postgresSql').toString()
}, {
name: 'MySQL',
body: 'FROM mysql:5.6\n' +
'# Set required environment variables\n' +
'ENV MYSQL_USER root\n' +
'ENV MYSQL_PASSWORD root\n' +
'ENV MYSQL_ROOT_PASSWORD root\n' +
'ENV MYSQL_DATABASE app\n\n' +
'# Open port 3306 on the server\n' +
'EXPOSE 3306\n'
body: fs.readFileSync(__dirname + '/sourceDockerFiles/mysql').toString()
}, {
name: 'MongoDB',
body: '# Full list of versions available here: https://registry.hub.docker.com/_/mongo/tags/manage/\n'+
Expand Down
10 changes: 10 additions & 0 deletions scripts/sourceDockerfiles/mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM mysql:5.6

# Set required environment variables
ENV MYSQL_USER root
ENV MYSQL_PASSWORD root
ENV MYSQL_ROOT_PASSWORD root
ENV MYSQL_DATABASE app

# Open port 3306 on the server
EXPOSE 3306
18 changes: 18 additions & 0 deletions scripts/sourceDockerfiles/nodejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Full list of versions available here: https://registry.hub.docker.com/_/node/tags/manage/\n' +
FROM node:<nodejs-version>

# Open up ports on the server
EXPOSE <user-specified-ports>

# Add repository files to serv
ADD ./<repo-name> /<repo-name>
WORKDIR /<repo-name>

# Install dependencies
RUN apt-get update
<add-dependencies>

RUN npm install

# Command to start the app
CMD <start-command>
9 changes: 9 additions & 0 deletions scripts/sourceDockerfiles/postgresSql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Full list of versions available here: https://registry.hub.docker.com/_/postgres/tags/manage/
FROM postgres:9.4

# Set recommended environment variables
ENV POSTGRES_USER postgres
ENV POSTGRES_PASSWORD postgres

# Open port 5432 on the server
EXPOSE 5432
20 changes: 20 additions & 0 deletions scripts/sourceDockerfiles/python
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:<python-version>

# Open up ports on the server
EXPOSE <user-specified-ports>

# Install environmental dependencies
RUN apt-get -y -q update && apt-get install -y -q libmysqlclient-dev postgresql-server-dev-9.1

# Add the repository to the /home folder
ADD ./<repo-name> /home/
WORKDIR /home

# Install dependencies
RUN pip install -r /home/requirements.txt

RUN apt-get update
<add-dependencies>

# Command to start the app
CMD <start-command>
30 changes: 30 additions & 0 deletions scripts/sourceDockerfiles/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ruby:<ruby-version>
# Open up ports on the server
EXPOSE <user-specified-ports>

# Install Rails (and its dependencies)
RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*


# see http://guides.rubyonrails.org/command_line.html#rails-dbconsole
RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/*

# Specify the version of Rails to install
ENV RAILS_VERSION <rails-version>
RUN gem install rails --version "$RAILS_VERSION"

# Add repository files to server
ADD ./<repo-name> /<repo-name>
WORKDIR /<repo-name>

# Install dependencies
RUN apt-get update
<add-dependencies>

RUN bundle install

# Setup and seed database
RUN rake db:create db:migrate

# Command to start the app
CMD <start-command>
26 changes: 26 additions & 0 deletions scripts/sourceDockerfiles/ruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ruby:<ruby-version>
# Open up ports on the server
EXPOSE <user-specified-ports>

# Install Rails (and its dependencies)
RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*


# see http://guides.rubyonrails.org/command_line.html#rails-dbconsole
RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/*

# Add repository files to server
ADD ./<repo-name> /<repo-name>
WORKDIR /<repo-name>

# Install dependencies
RUN apt-get update
<add-dependencies>

RUN bundle install

# Setup and seed database
RUN rake db:create db:migrate

# Command to start the app
CMD <start-command>