mirror of
https://github.com/xwiki-labs/cryptpad-docker.git
synced 2024-11-24 04:25:05 +00:00
c5a69aa6cc
Signed-off-by: Adrian Nöthlich <git@promasu.tech>
49 lines
1.1 KiB
Docker
49 lines
1.1 KiB
Docker
# Multistage build to reduce image size and increase security
|
|
FROM node:12-buster-slim AS build
|
|
|
|
# Install requirements to clone repository and install deps
|
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq git
|
|
RUN npm install -g bower
|
|
|
|
# Create folder for cryptpad
|
|
RUN mkdir /cryptpad
|
|
WORKDIR /cryptpad
|
|
|
|
# Get cryptpad from repository submodule
|
|
COPY cryptpad /cryptpad
|
|
|
|
# Install dependencies
|
|
RUN npm install --production \
|
|
&& npm install -g bower \
|
|
&& bower install --allow-root
|
|
|
|
# Create actual cryptpad image
|
|
FROM node:12-buster-slim
|
|
|
|
# Create user and group for cryptpad so it does not run as root
|
|
RUN groupadd cryptpad -g 4001
|
|
RUN useradd cryptpad -u 4001 -g 4001 -d /cryptpad
|
|
|
|
# Copy cryptpad with installed modules
|
|
COPY --from=build --chown=cryptpad /cryptpad /cryptpad
|
|
USER cryptpad
|
|
|
|
# Create directory for data
|
|
RUN mkdir /cryptpad/data
|
|
|
|
|
|
# Set workdir to cryptpad
|
|
WORKDIR /cryptpad
|
|
|
|
# Volumes for data persistence
|
|
VOLUME /cryptpad/customize
|
|
VOLUME /cryptpad/datastore
|
|
VOLUME /cryptpad/data
|
|
VOLUME /cryptpad/block
|
|
VOLUME /cryptpad/blob
|
|
|
|
# Ports
|
|
EXPOSE 3000 3001
|
|
|
|
# Run cryptpad on startup
|
|
CMD ["server.js"]
|