mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-06-29 02:40:14 +02:00
docker testing
This commit is contained in:
parent
ddc5229136
commit
100c62f39b
7
.dockerignore
Normal file
7
.dockerignore
Normal file
|
@ -0,0 +1,7 @@
|
|||
node_modules
|
||||
.git
|
||||
.gitignore
|
||||
.pre-commit-config.yaml
|
||||
.prettierrc.json
|
||||
.env.local
|
||||
.next
|
28
Dockerfile
Normal file
28
Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
|||
FROM node:18-buster-slim
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl git jq borgbackup openssh-server && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN groupadd borgwarehouse
|
||||
|
||||
RUN useradd -m -g borgwarehouse borgwarehouse
|
||||
|
||||
WORKDIR /home/borgwarehouse/app
|
||||
|
||||
RUN git clone -b v2.0 https://github.com/Ravinou/borgwarehouse.git .
|
||||
|
||||
RUN chown -R borgwarehouse:borgwarehouse * .*
|
||||
|
||||
USER borgwarehouse
|
||||
|
||||
RUN npm ci --only=production
|
||||
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["./docker-bw-init.sh"]
|
||||
|
||||
CMD ["npm", "run", "start"]
|
24
docker-bw-init.sh
Executable file
24
docker-bw-init.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
SSH_DIR="/home/borgwarehouse/.ssh"
|
||||
AUTHORIZED_KEYS_FILE="$SSH_DIR/authorized_keys"
|
||||
REPOS_DIR="/home/borgwarehouse/repos"
|
||||
|
||||
if [ ! -d "$SSH_DIR" ]; then
|
||||
echo "The .ssh directory does not exist, creating..."
|
||||
mkdir -p "$SSH_DIR"
|
||||
chmod 700 "$SSH_DIR"
|
||||
fi
|
||||
|
||||
if [ ! -f "$AUTHORIZED_KEYS_FILE" ]; then
|
||||
echo "The authorized_keys file does not exist, creating..."
|
||||
touch "$AUTHORIZED_KEYS_FILE"
|
||||
chmod 600 "$AUTHORIZED_KEYS_FILE"
|
||||
fi
|
||||
|
||||
if [ ! -d "$REPOS_DIR" ]; then
|
||||
echo "The repos directory does not exist, creating..."
|
||||
mkdir -p "$REPOS_DIR"
|
||||
fi
|
||||
|
||||
exec "$@"
|
Loading…
Reference in a new issue