improve docker images, fix jsep and initial build

This commit is contained in:
wodka 2019-07-01 10:03:29 +02:00
parent c3153ed514
commit b3bf791d3c
5 changed files with 63 additions and 39 deletions

View File

@ -4,33 +4,16 @@
# Run:
# docker run -it tellform-prod
FROM phusion/baseimage:0.9.19
FROM node:10-alpine
MAINTAINER Arielle Baldwynn <team@tellform.com>
# Install Utilities
RUN apt-get update -q \
&& apt-get install -yqq \
curl \
ant \
git \
gcc \
make \
build-essential \
libkrb5-dev \
python \
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 some needed packages
RUN apk add --no-cache \
git \
&& rm -rf /tmp/*
# Install NPM Global Libraries
RUN npm install --quiet -g grunt bower pm2 && npm cache clean
RUN npm install --quiet -g grunt bower pm2 && npm cache clean --force
WORKDIR /opt/tellform
RUN mkdir -p /opt/tellform/public/lib
@ -47,6 +30,39 @@ COPY ./gruntfile.js /opt/tellform/gruntfile.js
COPY ./server.js /opt/tellform/server.js
COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js
# Set default ENV
ENV NODE_ENV=development
ENV SECRET_KEY=ChangeMeChangeMe
#ENV MONGODB_URI=mongodb://mongo/tellform
#ENV REDIS_URL=redis://redis:6379
ENV PORT=5000
ENV BASE_URL=localhost
ENV SOCKET_PORT=20523
ENV SIGNUP_DISABLED=FALSE
ENV SUBDOMAINS_DISABLED=FALSE
ENV ENABLE_CLUSTER_MODE=FALSE
ENV MAILER_EMAIL_ID=tellform@localhost
ENV MAILER_PASSWORD=
ENV MAILER_FROM=tellform@localhost
ENV MAILER_SERVICE_PROVIDER=
ENV MAILER_SMTP_HOST=
ENV MAILER_SMTP_PORT=
ENV MAILER_SMTP_SECURE=
ENV CREATE_ADMIN=FALSE
ENV ADMIN_EMAIL=admin@localhost
ENV ADMIN_USERNAME=root
ENV ADMIN_PASSWORD=root
ENV APP_NAME=Tellform
ENV APP_KEYWORDS=
ENV APP_DESC=
# optional ENV settings
ENV COVERALLS_REPO_TOKEN=
ENV GOOGLE_ANALYTICS_ID=
ENV RAVEN_DSN=
# 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
@ -54,6 +70,7 @@ COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js
# Add npm package.json
COPY ./package.json /opt/tellform/package.json
RUN npm install --only=production --quiet
RUN grunt build
# Run TellForm server
CMD ["node", "server.js"]

View File

@ -37,7 +37,7 @@
"angular-translate": "~2.11.0",
"ng-translate": "*",
"deep-diff": "^0.3.4",
"jsep": "^0.3.1",
"jsep": "0.3.1",
"ngclipboard": "^1.1.1",
"mobile-detect": "^1.3.3",
"socket.io-client": "^1.7.2",

View File

@ -3,31 +3,29 @@ services:
redis:
restart: always
image: redis
volumes:
- "${PWD}/.env:/opt/tellform/.env"
networks:
- back-tier
mongo:
restart: always
image: mongo
volumes:
- "$ROOT/mongo:/data"
- ".data/mongo:/data"
networks:
- back-tier
tellform:
build:
context: .
env_file:
- .env
volumes:
# - "${PWD}/.env:/opt/tellform/.env"
- .:/opt/tellform
environment:
CREATE_ADMIN: "TRUE"
MONGODB_URI: mongodb://mongo/tellform
REDIS_URL: redis://redis
# volumes:
# - .:/opt/tellform
links:
- mongo
- redis
ports:
- "5000:5000"
# - "20523:20523"
depends_on:
- mongo
- redis
@ -43,10 +41,10 @@ services:
- "80:80"
- "443:443"
- "20523:20523"
env_file:
- .env
volumes:
- "$ROOT/certs:/certs"
environment:
NODE_ENV: development
#volumes:
# - "$ROOT/certs:/certs"
# - ./nginx/conf.d:/etc/nginx/conf.d
networks:
- back-tier

View File

@ -8,4 +8,12 @@ RUN chmod +x /start.py
RUN chmod +x /letsencrypt.py
RUN chmod +x /config.py
ENV NODE_ENV=development
ENV PORT=5000
ENV SOCKET_PORT=20523
ENV TLS_FLAVOR=notls
ENV BASE_URL=localhost
ENV SUBDOMAIN_URL=*.localhost
ENV SOCKETS_URL=ws.localhost
CMD /start.py

View File

@ -40,7 +40,8 @@ const smtpTransport = nodemailer.createTransport(config.mailer.options);
smtpTransport.verify(function(error, success) {
if (error) {
console.error(chalk.red('Your mail configuration is incorrect: ' + error));
process.exit(-1);
// verify but to abort!
// process.exit(-1);
}
});
@ -48,7 +49,7 @@ smtpTransport.verify(function(error, success) {
var app = require('./config/express')(db);
//Create admin account
if (process.env.CREATE_ADMIN_ACCOUNT === 'TRUE') {
if (process.env.CREATE_ADMIN === 'TRUE') {
var create_admin = require('./scripts/create_admin');
create_admin.run(app, db, function(err){