mirror of
https://github.com/xwiki-labs/cryptpad-docker.git
synced 2024-11-22 16:05:04 +00:00
66 lines
1.6 KiB
Text
66 lines
1.6 KiB
Text
|
# Multistage build to reduce image size and increase security
|
||
|
|
||
|
FROM node:12-alpine AS build
|
||
|
|
||
|
# Install requirements to clone repository and install deps
|
||
|
RUN apk add --no-cache git \
|
||
|
&& npm install -g bower
|
||
|
|
||
|
# Get cryptpad from repository submodule
|
||
|
COPY cryptpad /cryptpad
|
||
|
|
||
|
WORKDIR /cryptpad
|
||
|
|
||
|
# Install dependencies
|
||
|
RUN npm install --production \
|
||
|
&& npm install -g bower \
|
||
|
&& bower install --allow-root
|
||
|
|
||
|
# Create actual cryptpad image
|
||
|
FROM node:12-alpine
|
||
|
|
||
|
RUN set -x \
|
||
|
# Create users and groups for nginx and cryptpad
|
||
|
&& addgroup -g 4001 -S cryptpad \
|
||
|
&& adduser -u 4001 -S -D -G cryptpad -H -h /dev/null cryptpad \
|
||
|
\
|
||
|
# Create needed dir for nginx pid
|
||
|
&& mkdir -p /var/run/nginx \
|
||
|
\
|
||
|
# Install packages
|
||
|
&& apk add supervisor nginx openssl zlib pcre \
|
||
|
&& rm -rf /etc/nginx
|
||
|
|
||
|
# Copy nginx conf from official image
|
||
|
COPY --from=nginx:latest /etc/nginx /etc/nginx
|
||
|
|
||
|
# Copy cryptpad with installed modules
|
||
|
COPY --from=build --chown=cryptpad /cryptpad /cryptpad
|
||
|
|
||
|
# Copy supervisord conf file
|
||
|
COPY supervisord.conf /etc/supervisord.conf
|
||
|
|
||
|
# Copy docker-entrypoint.sh script
|
||
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||
|
|
||
|
# Set workdir to cryptpad
|
||
|
WORKDIR /cryptpad
|
||
|
|
||
|
# Create directories
|
||
|
RUN mkdir blob block customize data datastore \
|
||
|
&& chown cryptpad:cryptpad blob block customize data datastore
|
||
|
|
||
|
# Volumes for data persistence
|
||
|
VOLUME /cryptpad/blob \
|
||
|
/cryptpad/block \
|
||
|
/cryptpad/customize \
|
||
|
/cryptpad/data \
|
||
|
/cryptpad/datastore
|
||
|
|
||
|
# Ports
|
||
|
EXPOSE 80 443
|
||
|
|
||
|
ENTRYPOINT ["/bin/sh", "/docker-entrypoint.sh"]
|
||
|
|
||
|
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
|