From 271abf6b33952e32e5116e53bd0d130d7f630e15 Mon Sep 17 00:00:00 2001 From: Frank Agerholm Date: Sat, 15 Jul 2023 08:27:05 +0200 Subject: [PATCH] Deployment-script added. --- Dockerfile | 4 +++- bin/deploy.sh | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 bin/deploy.sh diff --git a/Dockerfile b/Dockerfile index 15ba77e..e775e3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,10 @@ RUN apk --no-cache add sshpass openssh-client lftp; mkdir -p /opt/app WORKDIR /opt/app ADD requirements.txt /root/ ADD Dockerfile /root/ +ADD bin/deploy.sh /usr/local/bin/deploy.sh # ignore "Running pip as root" warning ENV PIP_ROOT_USER_ACTION=ignore -RUN pip install -r /root/requirements.txt && pip freeze && rm -Rf "$(pip cache dir)" +RUN chmod 755 /usr/local/bin/deploy.sh && pip install -r /root/requirements.txt && pip freeze && rm -Rf "$(pip cache dir)" + diff --git a/bin/deploy.sh b/bin/deploy.sh new file mode 100755 index 0000000..bdf78f1 --- /dev/null +++ b/bin/deploy.sh @@ -0,0 +1,21 @@ +#!/bin/sh + + +if ! test -d website/output +then + echo "Website-Build not found" + exit 1 +fi + + +echo "SSH_USER=${SSH_USER}" +echo "SSH_HOST=${SSH_HOST}" +if [ -n "$LFTP_PASSWORD" ] +then + echo "Password for Deployment found" +fi + + +lftp -e 'set sftp:auto-confirm yes; mirror -R ./website/output/ ./web/; bye' --env-password -u ${SSH_USER} sftp://${SSH_HOST} + +