add docker configs

This commit is contained in:
b1ek 2023-03-04 12:39:13 +10:00
parent 335c3dfd3f
commit 59f178402e
Signed by: blek
GPG Key ID: 14546221E3595D0C
5 changed files with 43 additions and 1 deletions

View File

@ -1,4 +1,4 @@
APP_PORT=8080 APP_PORT=8080
APP_DEBUG=true APP_DEBUG=false
MAXLEN=5120 MAXLEN=5120

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM node:19
COPY . /opt/code
WORKDIR /opt/code
RUN rm -rf node_modules package_lock.json && \
npm install
CMD [ "/bin/sh", "-c", "/opt/code/run_instance.sh" ]

View File

@ -2,8 +2,16 @@
blek! Bin is a minimalist, privacy-respecting alternative to pastebin. blek! Bin is a minimalist, privacy-respecting alternative to pastebin.
# Running an instance # Running an instance
### Using npm
```bash ```bash
cp .env.example .env cp .env.example .env
# edit your .env # edit your .env
npm run dev/prod npm run dev/prod
```
### Using docker (recomended)
```bash
cp .env.example .env
# edit your .env
docker-compose up -d
``` ```

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: '3'
services:
server:
build:
context: '.'
dockerfile: Dockerfile
ports:
- '${APP_PORT:-8080}:${APP_PORT:-8080}'
volumes:
- './usercontent:/opt/code/usercontent'

13
run_instance.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
if ! [ -f .env ]; then
echo -e '\033[31m.env not found.'
exit -1
fi
. .env
if [ "$APP_DEBUG" == "true" ]; then
npm run dev
else
npm run prod
fi