Dockerfile 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
FROM debian:jessie
MAINTAINER Michał "rysiek" Woźniak <rysiek@hackerspace.pl>

ENV DEBIAN_FRONTEND noninteractive

# install the required packages
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        nodejs \
        ca-certificates \
        npm \
        curl \
        --no-install-recommends && \
    rm -rf /var/lib/apt/lists/*

# yeah, we need that because bin/installDeps.sh looks for node
# and debian has nodejs
RUN ln -s /usr/bin/nodejs /usr/bin/node

# get the newest nodejs version
RUN npm cache clean -f && npm install -g n && n stable
    
# make it sane, security-wise
RUN mkdir -p /opt/hazel /opt/hazel/config /opt/hazel/themes/default/public /opt/hazel/uploads /opt/hazel/content /opt/hazel/data && \
    groupadd -r hazel && \
    useradd -d /opt/hazel -r -g `getent group hazel | cut -d: -f3` hazel
    
# yay, clone the repo!
RUN cd /opt/hazel && npm install hazel-wiki --save && cp -a /opt/hazel/node_modules/hazel-wiki/app/themes/default/ /opt/hazel/themes/

COPY ./server.js /opt/hazel/
COPY ./config.default.js /opt/hazel/config/

# install the deps
# sync used due to a bug in Docker, working around "text file busy" error
RUN cd /opt/hazel/ && \
    chown -R hazel:hazel ./
    
# entrypoint script
#COPY start.sh /opt/hazel/start.sh
#RUN chmod ug+x /opt/hazel/start.sh
    
# expose, volume
EXPOSE 3000
VOLUME ["/opt/hazel/config/", "/opt/hazel/themes/", "/opt/hazel/uploads/", "/opt/hazel/content/", "/opt/hazel/data/", "/var/log/hazel/"]

# user, workdir
USER hazel
WORKDIR "/opt/hazel"

# command
#CMD ["/opt/hazel/start.sh"]
CMD ["/usr/bin/node", "server.js"]