-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from dvn0/dockerfile
meta: add Dockerfile
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
### | ||
# After building (eg. `docker build -t gitlab-mirrors .`) ... | ||
# you are expected to formulate a `docker run` command like the following: | ||
# | ||
# docker run -ti \ | ||
# --volume /path/to/config.sh:/home/gitmirror/gitlab-mirrors/config.sh:ro \ | ||
# --volume /path/to/ssh-keys:/home/gitmirror/.ssh \ | ||
# --volume /path/to/repositories:/home/gitmirror/repositories \ | ||
# gitlab-mirrors \ | ||
# <gitlab-mirrors cmd> <cmd options> # eg. add_mirror.sh --help | ||
### | ||
FROM debian:10 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && \ | ||
apt-get install -yqq \ | ||
python-pip \ | ||
git | ||
|
||
RUN pip install python-gitlab | ||
|
||
RUN adduser --shell /bin/sh --disabled-password --gecos "" gitmirror | ||
|
||
RUN mkdir /home/gitmirror/gitlab-mirrors | ||
|
||
COPY . /home/gitmirror/gitlab-mirrors | ||
|
||
RUN chown -R gitmirror:gitmirror /home/gitmirror | ||
|
||
USER gitmirror | ||
|
||
WORKDIR /home/gitmirror/gitlab-mirrors | ||
|
||
RUN mkdir /home/gitmirror/repositories && \ | ||
chmod 755 /home/gitmirror/gitlab-mirrors/*.sh | ||
|
||
ENV PATH=$PATH:/home/gitmirror/gitlab-mirrors | ||
|
||
ENTRYPOINT [ "/bin/bash", "/home/gitmirror/gitlab-mirrors/scripts/docker/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
SSH_DIR=/home/gitmirror/.ssh | ||
|
||
if [ ! -f "$SSH_DIR/id_ed25519" ]; then | ||
echo -e " * No SSH key found in $SSH_DIR.\n\ | ||
* You can generate a key like this: | ||
ssh-keygen -t ed25519 -f /path/to/ssh/key/dir/id_ed25519 -qN \"\" | ||
* Then make sure to run this image with --volume /path/to/ssh/key/dir:$SSH_DIR" | ||
fi | ||
|
||
exec "$@" |