Skip to content

Commit

Permalink
Use rsync within container to deploy docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bheisig committed Feb 14, 2024
1 parent 53bff8b commit 8fb439c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .jenkins/deploy/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pipeline {
REGISTRY_DOMAIN = 'registry.on.ops.docupike.net'
REGISTRY_PREFIX = "${REGISTRY_DOMAIN}/"
REGISTRY_CREDS = credentials('OPS_REGISTRY_CREDS')
SSH_KEY_DOCS = '~/.ssh/id_ecdsa'
}
stages {
stage('Pre-build') {
Expand All @@ -30,7 +31,7 @@ pipeline {
}
stage('Deploy') {
steps {
sh('scp -r site/* docs.docupike.com:/var/www/docs')
sh('docker-compose run env npm run docs:deploy')
}
}
stage('Push') {
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ RUN apt-get update; \
gnupg \
locales \
lsb-release \
openssh-client \
openssl \
python3 \
python3-apt \
python3-dev \
python3-pip \
python3-setuptools \
python3-venv \
rsync \
tar \
;\
apt-get clean; \
Expand Down Expand Up @@ -153,6 +155,12 @@ RUN pip3 install \
; \
ln -s /usr/bin/python3 /usr/bin/python

# OpenSSH client:
COPY data/ssh/config /etc/ssh/ssh_config.d/env.conf
COPY data/ssh/known_hosts /etc/ssh/ssh_known_hosts
RUN chmod 0644 /etc/ssh/ssh_config.d/env.conf; \
chmod 0644 /etc/ssh/ssh_known_hosts

RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc

ENV PATH="/home/runner/.local/bin:${PATH}"
Expand Down
10 changes: 10 additions & 0 deletions data/ssh/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Host docs.docupike.com
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
KexAlgorithms curve25519-sha256,[email protected],diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256
MACs [email protected],[email protected],[email protected]
HostKeyAlgorithms ssh-ed25519,[email protected],[email protected],[email protected],rsa-sha2-256,[email protected],rsa-sha2-512,[email protected]
StrictHostKeyChecking yes
IdentitiesOnly yes
IdentityFile /etc/ssh/keys/docs
Port 22
User docs
2 changes: 2 additions & 0 deletions data/ssh/known_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs.docupike.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEzBwZ9iHe6ddfsUJ6mlnB1EoPLrxRJ9259QmIh7+35j root@v220210656053155199
docs.docupike.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCUUa995JKtmGe1GEJyc/2YpIhURhdmOQ4xRF3Wgbz62cfzNoNF9DVlV24y8RAViSYCdoP38ZqIZ3NlaUA8h86IpMwfYV6E3kmnrql7t0cEtSL0WUwmZCbQO6EKldAtZaaxh9zRcy6pEQtqkDh0EVxbsD/iE18s9gc5oFDZ3U1FEjD9eGaGU6QXT/5L/0h988NowLwF5zbjl1z67W82AEkZLOrGfpy/K9UtASo//Nv0Wh315IZKI+Lc9RurrW+/re0TcVIfW5sT992DHkcRsONY3pncNxo3FT1UP783J/t9FBKbHVHf6cimlv9In+ilLJtzExPo1SaHHkFTWFMhy//WTEnuqtrEK8Us9UXq27ijRMn7ZUgG5QDUZQS6KSDrWleQD1GO1jZAoJ1ydux8JJsGxqZUz6+J2a+Sb4GcnxISYFTMaV/ujy5hpjCekx2osvitkwmLxVXHob9WnrTg4kDY1df0Q79YouFH3zvBuYdHCIUXgkQi+r+93Kjb4AXJ/lxIet8+CcoGrIg3782RtbsU560ZcvLOnjbbJQIdUQ/Q9oEcYcNmW+HRLnDZlk3jcAQ0zYcZjLNI4V4C7OfTa92TeTmcA84x2xIOLLKWwezGtyCT8afOAbJmioQ8dDhdxbAuwclP4rBnQnbdDo7qUfXrxN8gYqVIkjoOpJfO/HJGBQ== root@v220210656053155199
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
services:

env:
hostname: docs
build:
context: .
dockerfile: Dockerfile
args:
USER_ID: 1000
GROUP_ID: 1000
image: ${REGISTRY_PREFIX:-}docs/environment:main
environment:
SSH_AUTH_SOCK: /ssh-agent
volumes:
- "${PWD}:/runner/"
- home:/home/runner
- "${SSH_KEY_DOCS:-~/.ssh/cloud-production}:/etc/ssh/keys/docs:ro"
- "${SSH_KEY_DOCS:-~/.ssh/cloud-production}.pub:/etc/ssh/keys/docs.pub:ro"
- ${SSH_AUTH_SOCK:-/bin/true}:/ssh-agent
- /var/run/docker.sock:/var/run/docker.sock
cap_drop:
- ALL
privileged: false
group_add:
- ${DOCKER_GID:-998}
read_only: true
tmpfs:
- /tmp
Expand Down

0 comments on commit 8fb439c

Please sign in to comment.