feat: dev docker-compose

This commit is contained in:
Nicolas Giard 2018-08-28 00:23:05 -04:00
parent 4cb9f3d9c6
commit 2483dce941
6 changed files with 95 additions and 6 deletions

View File

@ -1,12 +1,19 @@
FROM requarks/wiki:latest # -- DEV DOCKERFILE --
# -- DO NOT USE IN PRODUCTION! --
# Replace with your email address: FROM node:8-alpine
ENV WIKI_ADMIN_EMAIL admin@example.com LABEL maintainer "requarks.io"
RUN apk update && \
apk add bash curl git python make g++ --no-cache && \
mkdir -p /var/wiki
WORKDIR /var/wiki WORKDIR /var/wiki
COPY package.json .
RUN yarn --silent
# Replace your-config.yml with the path to your config file: ENV dockerdev 1
ADD your-config.yml config.yml
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT [ "node", "server" ]
CMD ["tail", "-f", "/dev/null"]

16
dev/docker/config.yml Normal file
View File

@ -0,0 +1,16 @@
port: 3000
paths:
content: ./content
data: ./data
db:
type: postgres
host: db
port: 5432
user: wikijs
pass: wikijsrocks
db: wiki
redis:
host: redis
port: 6379
db: 0
logLevel: info

12
dev/examples/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM requarks/wiki:latest
# Replace with your email address:
ENV WIKI_ADMIN_EMAIL admin@example.com
WORKDIR /var/wiki
# Replace your-config.yml with the path to your config file:
ADD your-config.yml config.yml
EXPOSE 3000
ENTRYPOINT [ "node", "server" ]

50
docker-compose.yml Normal file
View File

@ -0,0 +1,50 @@
# -- DEV DOCKER-COMPOSE --
# -- DO NOT USE IN PRODUCTION! --
version: "3"
services:
redis:
image: redis:4-alpine
ports:
- "16379:6379"
logging:
driver: "none"
networks:
- wikinet
db:
image: postgres:9-alpine
environment:
POSTGRES_DB: wiki
POSTGRES_PASSWORD: wikijsrocks
POSTGRES_USER: wikijs
logging:
driver: "none"
volumes:
- db-data:/var/lib/postgresql/data
networks:
- wikinet
ports:
- "15432:5432"
wiki:
build:
context: .
dockerfile: dev/docker/Dockerfile
depends_on:
- db
- redis
networks:
- wikinet
ports:
- "3000:3000"
volumes:
- .:/var/wiki
- /var/wiki/node_modules
networks:
wikinet:
volumes:
db-data:

View File

@ -18,6 +18,10 @@ module.exports = {
dataRegex: path.join(WIKI.SERVERPATH, 'app/regex.js') dataRegex: path.join(WIKI.SERVERPATH, 'app/regex.js')
} }
if (process.env.dockerdev) {
confPaths.config = path.join(WIKI.ROOTPATH, 'dev/docker/config.yml')
}
process.stdout.write(chalk.blue(`Loading configuration from ${confPaths.config}... `)) process.stdout.write(chalk.blue(`Loading configuration from ${confPaths.config}... `))
let appconfig = {} let appconfig = {}