Support Docker

Close #6
This commit is contained in:
Aya Morisawa 2016-12-31 02:19:20 +09:00
parent 01bec14d42
commit 9034ae7e2c
2 changed files with 47 additions and 0 deletions

32
docker/Dockerfile Normal file
View File

@ -0,0 +1,32 @@
FROM base/archlinux
MAINTAINER Aya Morisawa
RUN rm /etc/pacman.d/mirrorlist
RUN echo 'Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist
RUN echo 'Server = http://ftp.tsukuba.wide.ad.jp/Linux/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist
RUN rm /etc/localtime
RUN ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
RUN pacman -Sy --noconfirm
RUN pacman -S --noconfirm pacman
RUN pacman-db-upgrade
RUN pacman -S --noconfirm archlinux-keyring
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm git nodejs npm mongodb redis
RUN echo '#!/bin/sh' >> /root/misskey.sh
RUN echo 'redis-server --daemonize yes' >> /root/misskey.sh
RUN echo 'mongod > /dev/null &' >> /root/misskey.sh
RUN echo 'cd /root/misskey' >> /root/misskey.sh
RUN echo 'npm start' >> /root/misskey.sh
RUN echo 'tail -f /dev/null' >> /root/misskey.sh
RUN chmod u+x /root/misskey.sh
EXPOSE 80
EXPOSE 443
EXPOSE 27017
CMD ["/root/misskey.sh"]

15
docker/README.md Normal file
View File

@ -0,0 +1,15 @@
# How to use Misskey with Docker
Ensure that the working directory is the repository root directory.
To create misskey image:
`sudo docker build -t misskey ./docker`
To run misskey:
`sudo docker run --rm -i -t -p $PORT:80 -v $(pwd):/root/misskey -v $DBPATH:/data/db misskey`
where $PORT is the port used to access Misskey Web from host browser
and $DBPATH is the path of MongoDB database on the host for data persistence.
ex: `sudo docker run --rm -i -t -p 80:80 -v $(pwd):/root/misskey -v /data/db:/data/db misskey`
Note that $(pwd) is the working directory.