Added Docker support

react_convert
Mark Moffat 2018-02-05 14:29:16 +01:00
parent 87c1ea8c63
commit 83e97a0d20
6 changed files with 62 additions and 1 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules/
.*

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules/
data/
config/settings.json
.vscode

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM mhart/alpine-node:8
ENV NODE_VERSION 8.9.4
WORKDIR /var/expressCart
COPY bin/ /var/expressCart/bin/
COPY config/ /var/expressCart/config/
COPY public/ /var/expressCart/public/
COPY routes/ /var/expressCart/routes/
COPY views/ /var/expressCart/views/
COPY app.js /var/expressCart/
COPY package.json /var/expressCart/
COPY gulpfile.js /var/expressCart/
RUN npm install
VOLUME /var/expressCart/data
EXPOSE 1111
ENTRYPOINT ["npm", "start"]

View File

@ -19,6 +19,14 @@ Keeping expressCart running after closing the terminal can be done in a few ways
> Note: Node.js version 7.x or greater is needed.
### Docker
The easiest way to get up and running is using Docker. Once the Docker CLI is installed from [https://www.docker.com/get-docker](https://www.docker.com/get-docker).
1. Enter the root of the expressCart application
2. Run: `docker-compose up --build`
3. Visit [http://127.0.0.1:1111](http://127.0.0.1:1111) in your browser
## Admin
Visit: [http://127.0.0.1:1111/admin](http://127.0.0.1:1111/admin)

View File

@ -21,6 +21,6 @@
"customCss": ".footer{padding-top: 5px;}",
"currencySymbol": "£",
"paymentGateway": "stripe",
"databaseConnectionString": "mongodb://expresscart:test@ds139909.mlab.com:39909/expresscart",
"databaseConnectionString": "mongodb://127.0.0.1:27017/expresscart",
"theme": "Cloth"
}

28
docker-compose.yml Normal file
View File

@ -0,0 +1,28 @@
version: '3'
services:
expresscart:
image: "node:8"
build: .
container_name: "expresscart"
environment:
NODE_ENV: development
NODE_PATH: /
ports:
- "1111:1111"
links:
- mongodb
depends_on:
- mongodb
mongodb:
image: mongo:latest
container_name: "mongodb"
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
# - MONGODB_USER="user"
# - MONGODB_PASS="pass"
volumes:
- ./data/db:/data/db
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null