-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version of Dockerizing the chat app
Close #3
- Loading branch information
Showing
3 changed files
with
69 additions
and
1 deletion.
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,11 @@ | ||
FROM bitnami/git:latest | ||
RUN install_packages less | ||
RUN mkdir /slick | ||
COPY entrypoint.sh /slick | ||
|
||
RUN chmod +x /slick/entrypoint.sh | ||
|
||
COPY chat.sh /slick | ||
WORKDIR /slick | ||
ENTRYPOINT ["./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 |
---|---|---|
|
@@ -56,4 +56,21 @@ Maybe slightly in order of importance - but not necessarily order of implementat | |
* [Private message support, just for the fun of it](https://github.com/JKrag/GitSlick/issues/4) | ||
* [Support running in split-screen terminal](https://github.com/JKrag/GitSlick/issues/5) | ||
* [Add a run-mode where chat takes place under the hood in an existing repo](https://github.com/JKrag/GitSlick/issues/6) | ||
* I had the idea that it might be a good idea with a small safety check to avoid running chat.sh in the wrong repo. My initial thought was that it could be as simple as checking for the existance of a possibly empty `.gitslick` file in the root of the repo, and aborting f this doesn't exist. But writing this, I realise that it would either have to be an untracked file, or it would have to be copied over and added to each new branch. maybe it could look for this file in the .git folder? More thinking needed. | ||
* I had the idea that it might be a good idea with a small safety check to avoid running chat.sh in the wrong repo. My initial thought was that it could be as simple as checking for the existance of a possibly empty `.gitslick` file in the root of the repo, and aborting f this doesn't exist. But writing this, I realise that it would either have to be an untracked file, or it would have to be copied over and added to each new branch. maybe it could look for this file in the .git folder? More thinking needed. | ||
|
||
## Docker | ||
|
||
In case you want chat without cloning the chat repo locally, and without leaving too many traces on your computer, | ||
you acn run the whoe thing in Docker. | ||
|
||
### Build image | ||
|
||
``` | ||
docker to build -t gitslick . | ||
``` | ||
|
||
### Run image | ||
|
||
``` | ||
docker run -it -v ~/.ssh:/tmp/.ssh:ro gitslick -r [email protected]:JKrag/demo.git -e "[email protected]" -n "Whale Hail" | ||
``` |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
usage() { | ||
echo "Usage: $0 -r <REPOSITORY> -e <user.email> -n <user.name>" | ||
echo "Usage: $0 -h" | ||
echo "Note: REPOSITORY is the remote repo that you use to keep your GitSlick chat history" | ||
echo | ||
echo "Example: $0 -r https://github.com/JKrag/MySlick -e <me@localhost> -n \"My name\"" | ||
exit 1; | ||
} | ||
|
||
while getopts r:e:n:h option; do | ||
case "${option}" | ||
in | ||
r) REPOSITORY=${OPTARG};; | ||
e) EMAIL=${OPTARG};; | ||
n) NAME=${OPTARG};; | ||
h) usage;; | ||
*) usage;; | ||
esac | ||
done | ||
|
||
|
||
# To be Windows compatible, we volume mount ssh keys to /tmp/.ssh and move them here | ||
# instead of mounting directly to ~/.ssh. For more info see: | ||
# https://nickjanetakis.com/blog/docker-tip-56-volume-mounting-ssh-keys-into-a-docker-container | ||
cp -R /tmp/.ssh /root/.ssh | ||
chmod 700 /root/.ssh | ||
chmod 644 /root/.ssh/id_rsa.pub | ||
chmod 600 /root/.ssh/id_rsa | ||
|
||
git config --global user.name "$NAME" | ||
git config --global user.email "$EMAIL" | ||
#git config core.sshCommand 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' | ||
git config --global core.sshCommand 'ssh -o StrictHostKeyChecking=no' | ||
|
||
#echo "CHAT REPO: $REPOSITORY" | ||
git clone -q "$REPOSITORY" chat | ||
cd chat || exit | ||
../chat.sh |