zweicoder / phoenix-docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Phoenix Docker

Docker environment to quickly setup an environment with Phoenix and Elixir installed properly.

Due to how Mix dependencies are installed, a docker-user is created when building the Docker image. up.sh then chowns the directory with another user (inheriting the same UID and GID as the current user). This prevents permission issues when mounting the volume.

Usage

# Pull the Docker image
docker pull zweicoder/phoenix-docker

# Copy / Download up.sh to your project directory
# Make sure the file is executable
chmod u+x up.sh

# Mount current directory into Docker container
./up.sh

# Run mix / phoenix commands as per normal
mix phoenix.new hello_phoenix

FAQ

Why not just use the Docker -u flag?

  • The Mix dependencies will either have to be installed in root/.mix or /home/<user>/.mix, which causes issues unless we chown the directory it was installed at.
  • Also, when using something like docker run -u "$(id -u):$(id -g)" the UID and GID will probably not be present in the container's /etc/passwd file. Some applications will fail to start because of this. See this post

About


Languages

Language:Shell 100.0%