Merge branch 'docker' of https://github.com/coldfix/cryptpad into staging
This commit is contained in:
commit
b8bf179e3b
33
Dockerfile
33
Dockerfile
@ -1,36 +1,13 @@
|
|||||||
FROM ubuntu:16.04
|
FROM node:6-alpine
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
|
||||||
vim \
|
|
||||||
wget \
|
|
||||||
git \
|
|
||||||
curl \
|
|
||||||
npm \
|
|
||||||
nodejs-legacy
|
|
||||||
|
|
||||||
ARG VERSION=0.3.0
|
|
||||||
|
|
||||||
# Download stable version
|
|
||||||
# RUN wget https://github.com/xwiki-labs/cryptpad/archive /${VERSION}.tar.gz -O /cryptpad.tar.gz \
|
|
||||||
# && mkdir -p /cryptpad \
|
|
||||||
# && tar -xzf /cryptpad.tar.gz -C /cryptpad --strip-components=1 \
|
|
||||||
# && rm /cryptpad.tar.gz
|
|
||||||
|
|
||||||
# Download from github
|
|
||||||
# RUN git clone https://github.com/xwiki-labs/cryptpad.git
|
|
||||||
|
|
||||||
# Add code directly
|
|
||||||
ADD . /cryptpad
|
|
||||||
|
|
||||||
|
COPY . /cryptpad
|
||||||
WORKDIR /cryptpad
|
WORKDIR /cryptpad
|
||||||
|
|
||||||
RUN npm install \
|
RUN apk add --no-cache git tini \
|
||||||
|
&& npm install \
|
||||||
&& npm install -g bower \
|
&& npm install -g bower \
|
||||||
&& bower install --allow-root
|
&& bower install --allow-root
|
||||||
|
|
||||||
ADD container-start.sh /container-start.sh
|
|
||||||
RUN chmod u+x /container-start.sh
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
VOLUME /cryptpad/datastore
|
VOLUME /cryptpad/datastore
|
||||||
@ -40,4 +17,4 @@ ENV USE_SSL=false
|
|||||||
ENV STORAGE='./storage/file'
|
ENV STORAGE='./storage/file'
|
||||||
ENV LOG_TO_STDOUT=true
|
ENV LOG_TO_STDOUT=true
|
||||||
|
|
||||||
CMD /container-start.sh
|
CMD ["/sbin/tini", "--", "/cryptpad/container-start.sh"]
|
||||||
|
|||||||
14
container-start.sh
Normal file → Executable file
14
container-start.sh
Normal file → Executable file
@ -1,23 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Creating customize folder
|
# Creating customize folder
|
||||||
mkdir -p customize
|
mkdir -p customize
|
||||||
[[ ! "$(ls -A customize)" ]] && echo "Creating customize folder" \
|
[ -z "$(ls -A customize)" ] && echo "Creating customize folder" \
|
||||||
&& cp -R customize.dist/* customize/ \
|
&& cp -R customize.dist/* customize/ \
|
||||||
&& cp config.js.dist customize/config.js
|
&& cp config.js.dist customize/config.js
|
||||||
|
|
||||||
# Linking config.js
|
# Linking config.js
|
||||||
[[ ! -h config.js ]] && echo "Linking config.js" && ln -s customize/config.js config.js
|
[ ! -h config.js ] && echo "Linking config.js" && ln -s customize/config.js config.js
|
||||||
|
|
||||||
# Configure
|
# Configure
|
||||||
[[ -n "$USE_SSL" ]] && echo "Using secure websockets: $USE_SSL" \
|
[ -n "$USE_SSL" ] && echo "Using secure websockets: $USE_SSL" \
|
||||||
&& sed -i "s/useSecureWebsockets: .*/useSecureWebsockets: ${USE_SSL},/g" customize/config.js
|
&& sed -i "s/useSecureWebsockets: .*/useSecureWebsockets: ${USE_SSL},/g" customize/config.js
|
||||||
|
|
||||||
[[ -n "$USE_SSL" ]] && echo "Using storage adapter: $STORAGE" \
|
[ -n "$STORAGE" ] && echo "Using storage adapter: $STORAGE" \
|
||||||
&& sed -i "s/storage: .*/storage: ${STORAGE},/g" customize/config.js
|
&& sed -i "s/storage: .*/storage: ${STORAGE},/g" customize/config.js
|
||||||
|
|
||||||
[[ -n "$LOG_TO_STDOUT" ]] && echo "Logging to stdout: $LOG_TO_STDOUT" \
|
[ -n "$LOG_TO_STDOUT" ] && echo "Logging to stdout: $LOG_TO_STDOUT" \
|
||||||
&& sed -i "s/logToStdout: .*/logToStdout: ${LOG_TO_STDOUT},/g" customize/config.js
|
&& sed -i "s/logToStdout: .*/logToStdout: ${LOG_TO_STDOUT},/g" customize/config.js
|
||||||
|
|
||||||
|
|
||||||
exec node ./server.js
|
exec node ./server.js
|
||||||
|
|||||||
@ -7,6 +7,21 @@
|
|||||||
- Adding config.js to customize folder
|
- Adding config.js to customize folder
|
||||||
- Persistance for datastore and customize folder
|
- Persistance for datastore and customize folder
|
||||||
|
|
||||||
|
## Run
|
||||||
|
|
||||||
|
Run from the cryptpad source directory:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t xwiki/cryptpad .
|
||||||
|
docker run --restart=always -d --name cryptpad -p 3000:3000 -v /var/cryptpad:/cryptpad/datastore xwiki/cryptpad
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, using docker-compose
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -28,21 +43,6 @@ Set configurations Dockerfile or in .env (using docker-compose) file.
|
|||||||
The .env variables are read by docker-compose and forwarded to docker container.
|
The .env variables are read by docker-compose and forwarded to docker container.
|
||||||
On runtime, in `bin/container-start.sh` the settings are written to the `config.js` file.
|
On runtime, in `bin/container-start.sh` the settings are written to the `config.js` file.
|
||||||
|
|
||||||
## Run
|
|
||||||
|
|
||||||
With docker
|
|
||||||
|
|
||||||
```
|
|
||||||
docker build -t xwiki/cryptpad .
|
|
||||||
docker -d --name cryptpad -p 3000:3000 -v ${PWD}/data:/cryptpad/datastore xwiki/cryptpad
|
|
||||||
```
|
|
||||||
|
|
||||||
With docker-compose
|
|
||||||
|
|
||||||
```
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Persistance
|
## Persistance
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user