├── .gitignore ├── Dockerfile ├── README.md ├── docker-compose.yml └── leanote_install_data.tar.gz /.gitignore: -------------------------------------------------------------------------------- 1 | leanote_data/ 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | ENV LEANOTE_VERSION=2.6.1 4 | 5 | RUN apk --update add curl mongodb-tools && \ 6 | curl -L http://sourceforge.net/projects/leanote-bin/files/${LEANOTE_VERSION}/leanote-linux-amd64-v${LEANOTE_VERSION}.bin.tar.gz/download >> \ 7 | /usr/local/leanote-linux-amd64.bin.tar.gz && \ 8 | curl -L https://raw.githubusercontent.com/mariusv/docker-leanote/master/leanote_install_data.tar.gz >> \ 9 | /usr/local/leanote_install_data.tar.gz && \ 10 | apk del --purge curl && \ 11 | rm -rf /var/cache/apk/* \ 12 | && tar -xzvf /usr/local/leanote-linux-amd64.bin.tar.gz -C / \ 13 | && rm -f /usr/local/leanote-linux-amd64.bin.tar.gz \ 14 | && mkdir -p /leanote/data/public/upload \ 15 | && mkdir -p /leanote/data/files \ 16 | && mkdir -p /leanote/data/mongodb_backup \ 17 | && rm -r /leanote/public/upload \ 18 | && rm -r /leanote/mongodb_backup \ 19 | && ln -s /leanote/data/public/upload /leanote/public/upload \ 20 | && ln -s /leanote/data/files /leanote/files \ 21 | && ln -s /leanote/data/mongodb_backup /leanote/mongodb_backup \ 22 | && tar zxf /usr/local/leanote_install_data.tar.gz -C /leanote \ 23 | && rm -f /usr/local/leanote_install_data.tar.gz \ 24 | && chmod +x /leanote/bin/run.sh 25 | RUN hash=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-64};echo;); \ 26 | sed -i "s/app.secret=.*$/app.secret=$hash #/" /leanote/conf/app.conf; \ 27 | sed -i "s/db.host=.*$/db.host=db/" /leanote/conf/app.conf; \ 28 | sed -i "s/site.url=.*$/site.url=\${SITE_URL} /" /leanote/conf/app.conf; 29 | 30 | VOLUME /leanote/data/ 31 | 32 | EXPOSE 9000 33 | WORKDIR /leanote/bin 34 | ENTRYPOINT ["sh", "run.sh"] 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Leanote Docker Image 2 | All data is in /leanote/data volume. We can mount local data folder for this volume. 3 | More details from this [wiki](https://github.com/leanote/leanote/wiki) 4 | 5 | 6 | #### 1. Create data folder 7 | 8 | ``` 9 | mkdir -p ./leanote/data/{files,mongodb_backup,public/upload} 10 | ``` 11 | 12 | #### 2. Create the `docker-compose.yml` file 13 | 14 | content: 15 | ``` 16 | version: '2' 17 | 18 | services: 19 | db: 20 | restart: always 21 | container_name: mongodb_server 22 | image: mongo:3.2.3 23 | volumes: 24 | - ./leanote_data:/data/db 25 | 26 | server: 27 | image: mariusv/leanote 28 | environment: 29 | - SITE_URL="http://localhost:9000" 30 | depends_on: 31 | - db 32 | restart: always 33 | ports: 34 | - 9000:9000 35 | links: 36 | - db:mongodb 37 | container_name: leanote_server 38 | 39 | volumes: 40 | - ./leanote/data:/leanote/data 41 | ``` 42 | 43 | #### 2. Create the Stack which will include a MongoDB container and a Leanote one 44 | 45 | `docker-compose up -d` 46 | 47 | #### 3. Initialize database 48 | 49 | ``` 50 | docker exec -it leanote_server mongorestore -h db -d leanote --dir /leanote/leanote_install_data 51 | ``` 52 | 53 | #### 4. Profit :-) 54 | 55 | Once all the above steps are completed you can login using http://SERVER_IP:9000/login 56 | 57 | Credentials: 58 | 59 | - user: admin 60 | - password: abc123 (please **CHANGE** it) 61 | 62 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | db: 5 | restart: always 6 | container_name: mongodb_server 7 | image: mongo:3.2.3 8 | volumes: 9 | - ./leanote_data:/data/db 10 | 11 | server: 12 | image: mariusv/leanote 13 | environment: 14 | - SITE_URL="http://localhost:9000" 15 | depends_on: 16 | - db 17 | restart: always 18 | ports: 19 | - 9000:9000 20 | links: 21 | - db:mongodb 22 | container_name: leanote_server 23 | 24 | volumes: 25 | - ./leanote/data:/leanote/data 26 | -------------------------------------------------------------------------------- /leanote_install_data.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariusv/docker-leanote/76f9a62df65642739972305bb89a1b113873ee62/leanote_install_data.tar.gz --------------------------------------------------------------------------------