Skip to content

Commit 0599dfe

Browse files
authored
Merge pull request #183 from drsushanth/git_auth
Git Authentication
2 parents 3b500c9 + b4344f7 commit 0599dfe

3 files changed

Lines changed: 43 additions & 4 deletions

File tree

‎DOCKER.md‎

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,45 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel
8080
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
8181
```
8282

83+
## Remote Git Repo
84+
85+
Pass the following environment parameters:
86+
87+
```bash
88+
-e SYNC_WITH_REMOTE=1 \
89+
-e REMOTE_URL="<ssh url of the remote git repo>"
90+
```
91+
92+
Along with the parameters you will need four more files.
93+
94+
1. SSH config file
95+
```
96+
Host <hostname or remote repo>
97+
User git
98+
IdentityFile /root/.ssh/id_ed25519
99+
IdentitiesOnly yes # Optional to make sure you don't
100+
get too many authentication failure
101+
```
102+
2. SSH key file uploaded to your remote
103+
3. SSH Public key
104+
4. SSH Known Hosts file
105+
106+
As you wont be able to add the remote host's to the docker's known hosts
107+
file you have to provide the file
108+
109+
```bash
110+
ssh-keyscan -t ed25519 <host url> >> known_hosts
111+
```
112+
113+
The files need to be owned by root not by the UID and GID passed by you. Save
114+
the files in a folder *ssh* along with the *wiki* folder and pass both the folders as such.
115+
116+
```bash
117+
-v wiki:/wiki \
118+
-v ssh:/root/.ssh
119+
```
120+
83121
## Support Info
84122

85123
* Shell access whilst the container is running: `docker exec -it wikmd /bin/bash`
86124
* To monitor the logs of the container in realtime: `docker logs -f wikmd`
87-

‎Dockerfile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9-alpine3.17 as python-base
1+
FROM python:3.9-alpine3.17 AS python-base
22

33
# Prevents Python from writing pyc files.
44
ENV PYTHONDONTWRITEBYTECODE=1
@@ -32,11 +32,12 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
3232
RUN python -m venv $VIRTUAL_ENV
3333

3434
# BUILDER
35-
FROM python-base as python-builder
35+
FROM python-base AS python-builder
3636

3737
# Install our dependencies
3838
RUN apk update
3939
RUN apk add git
40+
RUN apk add openssh
4041
RUN apk add build-base linux-headers
4142

4243
# Python dependencies

‎src/wikmd/utils.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import unicodedata
33
import re
4+
import shutil
45

56
_filename_ascii_strip_re = re.compile(r"[^A-Za-z0-9 _.-]")
67
_windows_device_files = {
@@ -73,4 +74,4 @@ def move_all_files(src_dir: str, dest_dir: str):
7374
new_file += f".{file_split[1]}" # add the extension
7475
copies_count += 1
7576

76-
os.rename(f"{src_dir}/{file}", f"{dest_dir}/{new_file}")
77+
shutil.move(f"{src_dir}/{file}", f"{dest_dir}/{new_file}")

0 commit comments

Comments
 (0)