2020-03-05 00:48:53 +00:00
|
|
|
# Multistage build to reduce image size and increase security
|
2022-04-20 14:30:18 +00:00
|
|
|
FROM node:16-buster-slim AS build
|
2020-03-05 00:48:53 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2020-05-05 04:11:05 +00:00
|
|
|
# Get cryptpad from repository submodule
|
|
|
|
COPY cryptpad /cryptpad
|
2020-03-05 00:48:53 +00:00
|
|
|
|
2020-10-17 20:26:29 +00:00
|
|
|
RUN sed -i "s@//httpAddress: '::'@httpAddress: '0.0.0.0'@" /cryptpad/config/config.example.js
|
2021-06-22 10:58:00 +00:00
|
|
|
RUN sed -i "s@installMethod: 'unspecified'@installMethod: 'docker'@" /cryptpad/config/config.example.js
|
2020-05-06 19:58:10 +00:00
|
|
|
|
2020-03-05 00:48:53 +00:00
|
|
|
# Install dependencies
|
|
|
|
RUN npm install --production \
|
|
|
|
&& npm install -g bower \
|
|
|
|
&& bower install --allow-root
|
|
|
|
|
|
|
|
# Create actual cryptpad image
|
2022-04-20 14:30:18 +00:00
|
|
|
FROM node:16-buster-slim
|
2020-03-05 00:48:53 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
# Set workdir to cryptpad
|
|
|
|
WORKDIR /cryptpad
|
|
|
|
|
2020-05-07 09:56:22 +00:00
|
|
|
# Create directories
|
|
|
|
RUN mkdir blob block customize data datastore
|
|
|
|
|
2020-05-03 00:03:48 +00:00
|
|
|
# Volumes for data persistence
|
2020-05-06 13:28:01 +00:00
|
|
|
VOLUME /cryptpad/blob
|
|
|
|
VOLUME /cryptpad/block
|
2020-05-03 00:33:14 +00:00
|
|
|
VOLUME /cryptpad/customize
|
2020-05-03 00:03:48 +00:00
|
|
|
VOLUME /cryptpad/data
|
2020-05-06 13:28:01 +00:00
|
|
|
VOLUME /cryptpad/datastore
|
2020-05-03 00:03:48 +00:00
|
|
|
|
|
|
|
# Ports
|
|
|
|
EXPOSE 3000 3001
|
2020-03-05 00:48:53 +00:00
|
|
|
|
|
|
|
# Run cryptpad on startup
|
2021-05-04 15:13:38 +00:00
|
|
|
CMD ["npm", "start"]
|