get local-ssl-proxy working for testing prod locally
This commit is contained in:
parent
a14c232935
commit
b172087b98
7 changed files with 25 additions and 14 deletions
13
Dockerfile
13
Dockerfile
|
@ -4,21 +4,21 @@ ENV APP_HOME=/usr/src/app \
|
||||||
RUN mkdir -p $APP_HOME
|
RUN mkdir -p $APP_HOME
|
||||||
WORKDIR $APP_HOME
|
WORKDIR $APP_HOME
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
FROM base as development
|
FROM base as development
|
||||||
ENV NODE_ENV development
|
ENV NODE_ENV development
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
RUN npm rebuild node-sass
|
RUN npm rebuild node-sass
|
||||||
COPY .babelrc index.js nodemon.json webpack.config.babel.js webpack.config.dev.js webpack.config.prod.js webpack.config.server.js ./
|
COPY .babelrc index.js nodemon.json webpack.config.babel.js webpack.config.dev.js webpack.config.prod.js webpack.config.server.js webpack.config.examples.js ./
|
||||||
COPY client ./client
|
COPY client ./client
|
||||||
COPY server ./server
|
COPY server ./server
|
||||||
COPY scripts ./scripts
|
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|
||||||
FROM development as build
|
FROM development as build
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
# COPY .env ./
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM base as production
|
FROM base as production
|
||||||
|
@ -27,8 +27,9 @@ COPY package.json package-lock.json ./
|
||||||
RUN npm install --production
|
RUN npm install --production
|
||||||
RUN npm rebuild node-sass
|
RUN npm rebuild node-sass
|
||||||
RUN npm install pm2 -g
|
RUN npm install pm2 -g
|
||||||
COPY index.js ecosystem.json .babelrc ./
|
RUN npm install local-ssl-proxy
|
||||||
COPY scripts ./scripts
|
COPY index.js ecosystem.json ./
|
||||||
# COPY .env ./
|
|
||||||
COPY --from=build /usr/src/app/dist ./dist
|
COPY --from=build /usr/src/app/dist ./dist
|
||||||
|
RUN npm run ssl-proxy
|
||||||
|
#RUN npm run fetch-examples:prod
|
||||||
CMD ["pm2-runtime", "ecosystem.json"]
|
CMD ["pm2-runtime", "ecosystem.json"]
|
||||||
|
|
|
@ -6,8 +6,8 @@ services:
|
||||||
- dbdata:/data/db
|
- dbdata:/data/db
|
||||||
expose:
|
expose:
|
||||||
- "27017"
|
- "27017"
|
||||||
nginx:
|
# nginx:
|
||||||
build: ./nginx
|
# build: ./nginx
|
||||||
server:
|
server:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
@ -17,11 +17,15 @@ services:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
||||||
|
- API_URL=https://localhost/api
|
||||||
|
- PORT=80
|
||||||
volumes:
|
volumes:
|
||||||
- .:/opt/node/app
|
- .:/opt/node/app
|
||||||
- /opt/node/app/node_modules
|
- /opt/node/app/node_modules
|
||||||
ports:
|
ports:
|
||||||
- '8000:8000'
|
- '8000:8000'
|
||||||
|
- '80:80'
|
||||||
|
- '443:443'
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongo
|
- mongo
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -8,12 +8,16 @@
|
||||||
"start:prod": "cross-env NODE_ENV=production node index.js",
|
"start:prod": "cross-env NODE_ENV=production node index.js",
|
||||||
"lint": "eslint client server --ext .jsx --ext .js",
|
"lint": "eslint client server --ext .jsx --ext .js",
|
||||||
"lint-fix": "eslint client server --ext .jsx --ext .js --fix",
|
"lint-fix": "eslint client server --ext .jsx --ext .js --fix",
|
||||||
"build": "npm run build:client && npm run build:server",
|
"build": "npm run build:client && npm run build:server && npm run build:examples",
|
||||||
"build:client": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js --progress",
|
"build:client": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js --progress",
|
||||||
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js --progress",
|
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js --progress",
|
||||||
|
"build:examples": "cross-env NODE_ENV=production webpack --config webpack.config.examples.js --progress",
|
||||||
"test": "npm run lint",
|
"test": "npm run lint",
|
||||||
"fetch-examples": "node ./server/scripts/fetch-examples.js",
|
"fetch-examples": "node ./server/scripts/fetch-examples.js",
|
||||||
"fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js"
|
"fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js",
|
||||||
|
"fetch-examples:prod": "node ./dist/fetch-examples.bundle.js",
|
||||||
|
"fetch-examples-gg:prod": "node ./dist/fetch-examples.bundle.js",
|
||||||
|
"ssl-proxy": "local-ssl-proxy --source 443 --target 80 &"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Cassie Tarakajian",
|
"author": "Cassie Tarakajian",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require('babel-register');
|
require('babel-register');
|
||||||
require('babel-polyfill');
|
require('babel-polyfill');
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
}
|
}
|
||||||
require('./examples-gg-latest.js');
|
require('./examples-gg-latest.js');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require('babel-register');
|
require('babel-register');
|
||||||
require('babel-polyfill');
|
require('babel-polyfill');
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
}
|
}
|
||||||
require('./examples.js');
|
require('./examples.js');
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: 'cheap-module-eval-source-map',
|
devtool: 'cheap-module-eval-source-map',
|
||||||
|
|
|
@ -6,7 +6,7 @@ const cssnext = require('postcss-cssnext');
|
||||||
const postcssFocus = require('postcss-focus');
|
const postcssFocus = require('postcss-focus');
|
||||||
const postcssReporter = require('postcss-reporter');
|
const postcssReporter = require('postcss-reporter');
|
||||||
const cssnano = require('cssnano');
|
const cssnano = require('cssnano');
|
||||||
if (process.env.NODE_ENV !== "production") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue