Docker-compose mkdocs + nginx

Docker-compose mkdocs + nginx

별도의 mkdocs container 가 아닌 기본 Nginx 로 mkdocs Test 를 진행 했습니다.

추후 용도에 맞게 php + mysql 등을 설치 하여 사용하기 위하여 docker-compose 를 사용하였습니다.

mkdocs 설치의 경우 포스트를 참고해주세요.

Ubuntu mkdocs 설치

 

Docker-compose 설치

test@docker-test:~/Workspace$ sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
test@docker-test:~/Workspace$ sudo chmod +x /usr/local/bin/docker-compose
test@docker-test:~/Workspace$ docker-compose --version

 

디렉토리 구조 

test@docker-test:~/Workspace/mkdocs$ tree
.
├── docker-compose.yml
├── nginx
│   └── conf
│   └── default.conf
└── wiki

3 directories, 2 files
test@docker-test:~/Workspace/mkdocs$

 

docker-compose.yml 파일 

test@docker-test:~/Workspace/mkdocs$ cat docker-compose.yml
version: '2'

services:
    nginx:
        image: nginx:1.10.2
        ports:
            - 80:80
        restart: always
        volumes:
            - ./nginx/conf:/etc/nginx/conf.d
            - ./wiki/wiki/site:/code

test@docker-test:~/Workspace/mkdocs$

 

nginx/conf/default.conf 파일

test@docker-test:~/Workspace/mkdocs$ cat nginx/conf/default.conf
server {
    listen       80 default_server;
    server_name  localhost _;
    index        index.html index.htm;
    root         /code;

    location / {
        autoindex on;
    }
}

test@docker-test:~/Workspace/mkdocs$

 

mkdocs project 생성

test@docker-test:~/Workspace/mkdocs/wiki$ mkdocs new wiki
INFO - Creating project directory: wiki
INFO - Writing config file: wiki/mkdocs.yml
INFO - Writing initial docs: wiki/docs/index.md
test@docker-test:~/Workspace/mkdocs/wiki$ cd wiki/
test@docker-test:~/Workspace/mkdocs/wiki/wiki$ mkdocs build
INFO - Building documentation to directory: /home/test/Workspace/mkdocs/wiki/wiki/site
test@docker-test:~/Workspace/mkdocs/wiki/wiki$

test@docker-test:~/Workspace/mkdocs$ docker-compose up -d --build
Creating network "mkdocs_default" with the default driver
Creating mkdocs_nginx_1 ... done
test@docker-test:~/Workspace/mkdocs$

 

댓글 남기기