1
0
mirror of https://github.com/rlister/dockerfiles.git synced 2025-12-12 17:26:15 +00:00
This commit is contained in:
Richard Lister
2014-12-13 15:23:18 -05:00
parent 82aa3501a1
commit 4ad7c79a92
3 changed files with 82 additions and 0 deletions

20
hastebin/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
FROM debian:jessie
MAINTAINER Ric Lister, rlister@gmail.com
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
apt-get install -yq \
git \
nodejs npm
RUN git clone https://github.com/seejohnrun/haste-server.git /app
WORKDIR /app
RUN npm install
ADD ./app.sh /app/
RUN chmod 755 app.sh
EXPOSE 7777
CMD [ "./app.sh" ]

25
hastebin/README.md Normal file
View File

@@ -0,0 +1,25 @@
# Hastebin
[Hastebin](https://github.com/seejohnrun/haste-server) is a simple
pastebin, which can be installed on a protected network.
This dockerfile builds an image that can be configured using
environment variables. This is done by writing `config.js` at runtime
from interpolated variables in `app.sh`.
See `app.sh` for variable names.
## Example use
Writing pastes to a mounted local volume:
```
docker run --name hastebin -d -p 7777:7777 -e STORAGE_TYPE=file -e /data:/app/data rlister/hastebin
```
Writing pastes to redis:
```
docker run --name redis -d redis
docker run --name hastebin -d -p 7777:7777 --link redis:redis -e STORAGE_HOST=redis rlister/hastebin
```

37
hastebin/app.sh Normal file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
## write config file from environment vars
cat > config.js <<EOF
{
"host": "${HOST:-0.0.0.0}",
"port": ${PORT:-7777},
"keyLength": ${KEY_LENGTH:-10},
"maxLength": ${MAX_LENGTH:-400000},
"staticMaxAge": ${STATIC_MAX_AGE:-86400},
"recompressStaticAssets": ${RECOMPRESS_STATIC_ASSETS:-true},
"logging": [
{
"level": "${LOGGING_LEVEL:-verbose}",
"type": "${LOGGING_TYPE:-Console}",
"colorize": ${LOGGING_COLORIZE:-false}
}
],
"keyGenerator": {
"type": "${KEY_GENERATOR_TYPE:-phonetic}"
},
"storage": {
"type": "${STORAGE_TYPE:-redis}",
"path": "${STORAGE_PATH:-./data}",
"host": "${STORAGE_HOST:-0.0.0.0}",
"port": ${STORAGE_PORT:-6379},
"db": ${STORAGE_DB:-2},
"expire": ${STORAGE_EXPIRE:-2592000}
},
"documents": {
"about": "./about.md"
}
}
EOF
## run the server
exec /usr/bin/nodejs ./server.js