wernight / docker-codiad

Web-based cloud IDE and code editor with minimal footprint and requirements.
https://hub.docker.com/r/wernight/codiad/
8 stars 4 forks source link

`entrypoint.sh` always copies `/default-code` #2

Closed tom-tan closed 8 years ago

tom-tan commented 8 years ago

How to reproduce:

# docker run --rm -p 8080:80 \
    -e CODIAD_UID=$UID -e CODIAD_GID=$GID \
    -v $PWD/code:/code \
    -v /etc/localtime:/etc/localtime:ro \
    -v /var/run/docker.sock:/var/run/docker.sock:ro \
    wernight/codiad
define("LANGUAGE", "ja");

Expected: I can find the line define("LANGUAGE", "ja");. Actual: There are no line define("LANGUAGE", "ja"); because config.php is overwritten by /default-code/config.php.

The reason is that the statement [ ! -d '/code/.git' ] in entrypoint.sh always becomes true. This script expects that there exists /code/.git after installing Codiad but the line cp -r /default-code/* /code skip copying /default-code/.git.

A simple workaround is just to make a directory /code/.git after copying the contents.

wernight commented 8 years ago

Thanks for reporting issues you're having.

You're right on the logic that's in https://github.com/wernight/docker-codiad/blob/master/root/entrypoint.sh however that directectory should exist from https://github.com/wernight/docker-codiad/blob/master/Dockerfile#L58 : git clone https://github.com/Codiad/Codiad /default-code. So it should create that /code/.git directory.

I have it running but my /code contains .git.

Before putting a harder fix, I'd like to understand why it's not working as it should. May be you can check that directory content, access rights, or not mounting and docker exec in that container to check the content.

tom-tan commented 8 years ago

however that directectory should exist from https://github.com/wernight/docker-codiad/blob/master/Dockerfile#L58 .

/default-code/.git exists but it is not copied by entrypoint.sh because the wildcard * does not match the files and directories which start with . in bash, zsh and other shells.

wernight commented 8 years ago

Ah of course. Fixing

tom-tan commented 8 years ago

I confirmed it works. Thanks!