Giter Site home page Giter Site logo

nicbet / docker-phoenix Goto Github PK

View Code? Open in Web Editor NEW
276.0 13.0 56.0 151 KB

A dockerized Phoenix development and runtime environment.

License: GNU General Public License v3.0

Shell 12.70% Dockerfile 40.87% Makefile 46.43%
docker docker-image docker-compose phoenix-framework elixir elixir-phoenix development-environment

docker-phoenix's Introduction

A Containerized Dev Environment for Elixir and the Phoenix Framework

Introduction

A dockerized development environment to work on Elixir and Phoenix framework projects while keeping the host environment pristine.

This project was conceived to deal with the issues of running different Elixir and Phoenix versions and supporting the development and maintenance of apps built with different Elixir and Phoenix versions.

Maybe you are working on multiple different projects, built with different versions of the Phoenix framework, or you are working on a long-lived Elixir or Phoenix project. In either case you are likely to hit a version conflict. Phoenix and Elixir are still young and evolving which is great - but some of the changes will likely break your application code. This repository aims to make things easier for you by giving you a straightforward path in swapping out your Elixir and Phoenix environment.

Notable Changes

  • Switch to Bullseye base image This is a potentially breaking change if you are using this image / repository as a base for your own customized images. We're switching from the upstream Alpine images to Debian Bullseye images, since most build tools and libraries, as well as the Erlang documentation are not included in the Alpine stream. Since the primary focus of this repository is to give developers easy access to the entire toolchain to build their Elixir/Phoenix applications with minimal requirements on the host, and as much of an optimal out-of-the-box dev experience with VSCode, we've decided that we'd rather have full toolchains and documentation over smaller image sizes.

  • **Docker Phoenix 1.7.10 ** The default database for the compose stack and devcontainer is now PostgreSQL 16

  • Docker Phoenix 1.7.5 The image now includes the build-base package by default to support compile-time dependencies like bcrypt for mix phx.gen.auth

  • #1d570c14007b7750da776e0b6bd2b7568ec67de5 We've switched the default branch of the repository from master to main. Please update your local repository refs!

  • Docker Phoenix 1.6.15 We are currently in the process of switching to Alpine Linux based images, which are significantly smaller (~150MB vs 1.7GB). Expect the next release to make -alpine the new default for the dev environments. As a result, you will need to rebuild your VSCode dev containers and your application code.

  • Docker Phoenix 1.6.13 Starting with this version, we've switched the Docker image hosted at Docker Hub (docker pull nicbet/phoenix:1.6.13) to M1 Mac, i.e., linux/arm64/v8 architecture. If you are developing on an Intel machine, you will need to build the docker image on your platform to get started run make docker-image.

Getting Started

As of December 2022, we recommend using the Visual Studio Dev Containers approach over the command line. See below for details.

Visual Studio Code (Dev Containers)

Setting up a brand-new project

If you are using a recent version of Visual Studio Code with the Dev Containers extension, we highly recommend going this route for a much improved development experience out of the box.

  1. Use Degit to quickly clone this project as a scaffold for your new project, for example an app called hello_world.

    npx degit nicbet/docker-phoenix#1.7.12 hello_world
  2. Open the hello_world folder in Visual Studio Code

  3. When asked, select Reopen in container. Visual Studio code will create a complete application stack including a PostgreSQL database, and mount your local ./app folder as the root folder for the development environment.

  4. After initialization of your dev environment finishes, open the Terminal tab in Visual Studio Code.

  5. Create your new Phoenix application with the following command (note the .!):

    mix phx.new . hello_world
  6. As the mix command runs, you will see your Visual Studio Code file explorer populate with the files of your new phoenix app. All these files are available outside your development environment in the ./app folder.

Note: You don't need to use degit. Alternatively, you can clone this repository and remove the .git folder manually.

Configuring the Database Connection

Both, the docker-compose stack started with the docker-compose.yml file included with this repository and the Visual Studio Code Dev Containers stack define a service called db for running a PostgreSQL database that is available to the main application container via the hostname db. By default Phoenix assumes that you are running a database locally. In order to use the db service with your application you will need to modify your Phoenix config and point Ecto to the database host.

To use the included database with your phoenix application you will need to modify the Ecto configuration config/dev.exs and point it to the DB container:

# Configure your database
config :test, Test.Repo,
  adapter: Ecto.Adapters.Postgres,
  hostname: "db",
  username: "postgres",
  password: "postgres",
  # ...
  pool_size: 10

Running your Application

To start you application in development mode you will first need to change your Phoenix configuration to bind the phx.server to 0.0.0.0, so that the container exposes the phx.server to the host network.

To bind the phx.server to all interfaces, edit your config/dev.exs file and set the endpoint listen address to 0.0.0.0:

config :hello_world, HelloWorldWeb.Endpoint,
  http: [ip: {0, 0, 0, 0}, port: 4000],
  ...

From the VSCode terminal you can run the Phoenix application server with:

mix phx.server

Once the startup is completed, your app will be available at http://localhost:4000

Using the Command Line instead of Dev Containers

After cloning the repository, you can use the included ./run, ./mix, ./npm, and ./yarn scripts to execute commands in the development environment described by included docker-compose.yml file. For instance, running ./mix phx.new . hello_world would generate a new phoenix application called hello_world. Similarly to the Visual Studio Code Dev Containers approach, your project files will be locally stored in the ./app container which is mounted to /app inside the development environment.

The instructions for changing the database connection and bind address as described above apply here as well.

To run any command inside the dev container, you can use the ./run script and pass the command and its arguments.

./run iex -S mix

Building the image for your platform

You can locally build the container image with the included Makefile:

make docker-image

Usage with an existing project

You can use this project to dockerize the development environment for an existing project. Follow the steps above, but instead of initializing a new application with mix phx.new, copy your existing project code to the ./app subdirectory. This will make your existing code available in the dockerized dev environment.

Contributing

This project is intended to be a safe, welcoming space for collaboration. Contributors are expected to adhere to the Contributor Covenant code of conduct. We recommend reading the contributing guide as well.

License

Docker Phoenix is available as open source under the terms of the GNU Public License v3.

Contributors

Docker Phoenix is built by members of the Open Source community, including:

apenney, cruisemaniac, homanchou, tmr08c, jacknoble, ravloony, asifaly ,ajmeese7, restlessronin

docker-phoenix's People

Contributors

ajmeese7 avatar asifaly avatar bordernone avatar cruisemaniac avatar homanchou avatar jacknoble avatar kianmeng avatar nicbet avatar restlessronin avatar tmr08c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-phoenix's Issues

DB setup failed with non-existing domain

Overview

I followed the Getting started on README, the preparation of db failed. The error log is following.

❯ ./mix ecto.create
Starting battle-slot-server_db_1 ... done

11:37:40.119 [error] GenServer #PID<0.260.0> terminating
** (DBConnection.ConnectionError) tcp connect (db:5432): non-existing domain - :nxdomain
    (db_connection 2.3.1) lib/db_connection/connection.ex:100: DBConnection.Connection.connect/2
    (connection 1.1.0) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for BattleSlotServer.Repo couldn't be created: killed

dev.exs is following

config :test, Test.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "postgres",
  password: "postgres",
  database: "test_dev",
  hostname: "db",
  pool_size: 10

To fix this, adding env vars in docker-compose.yml like following.

  db:
    image: postgres:10
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_HOST=db

Thanks.

Move Docker image from Docker Hub to Github's ghcr.io Registry

With the rather unfriendly recent changes to Docker Hub in terms of autobuilding GH repos, as well as the introduced hosting/limits for free accounts it would be great to move the image to ghcr.io and have GH actions build and publish the Docker image.

segfault on mix phx.new

mix phx.new . hello_world gives the following error:

qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

Split image build code and VSCode integration into separate directories

The current repository structure is mixing these two concerns. It would be nice to have one directory, docker_build with all files concerned with building the docker images, and another directory vscode that contains the .devcontainer definitions. A third directory bin could house all executable scripts that we currently have in the root directory.

bcrypt not working

I tried to scaffold the auth system, but bcrypt doesn’t work:

  • mix phx.gen.auth Accounts User users --live
  • mix deps.get
  • mix ecto.migrate:
==> bcrypt_elixir
could not compile dependency :bcrypt_elixir, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean it with "mix deps.clean bcrypt_elixir"
==> phoenix_hoeraktion
** (Mix) "make" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.

I am on macOS 14.0 and am using the latest version of Phoenix Framework.

Following the instructions generates error dump it seems

sudo docker-compose up
phoenix_db_1_85f5f1d1343c is up-to-date
Creating phoenix_app_1_43af3c589570 ... done
Attaching to phoenix_db_1_85f5f1d1343c, phoenix_app_1_5fc54ca2d440
db_1_85f5f1d1343c | The files belonging to this database system will be owned by user "postgres".
db_1_85f5f1d1343c | This user must also own the server process.
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | The database cluster will be initialized with locale "en_US.utf8".
db_1_85f5f1d1343c | The default database encoding has accordingly been set to "UTF8".
db_1_85f5f1d1343c | The default text search configuration will be set to "english".
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | Data page checksums are disabled.
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1_85f5f1d1343c | creating subdirectories ... ok
db_1_85f5f1d1343c | selecting default max_connections ... 100
db_1_85f5f1d1343c | selecting default shared_buffers ... 128MB
db_1_85f5f1d1343c | selecting dynamic shared memory implementation ... posix
db_1_85f5f1d1343c | creating configuration files ... ok
db_1_85f5f1d1343c | running bootstrap script ... ok
db_1_85f5f1d1343c | performing post-bootstrap initialization ... ok
db_1_85f5f1d1343c | syncing data to disk ... ok
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | WARNING: enabling "trust" authentication for local connections
db_1_85f5f1d1343c | You can change this by editing pg_hba.conf or using the option -A, or
db_1_85f5f1d1343c | --auth-local and --auth-host, the next time you run initdb.
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | Success. You can now start the database server using:
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | ****************************************************
db_1_85f5f1d1343c | WARNING: No password has been set for the database.
db_1_85f5f1d1343c | This will allow anyone with access to the
db_1_85f5f1d1343c | Postgres port to access your database. In
db_1_85f5f1d1343c | Docker's default configuration, this is
db_1_85f5f1d1343c | effectively any other container on the same
db_1_85f5f1d1343c | system.
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | Use "-e POSTGRES_PASSWORD=password" to set
db_1_85f5f1d1343c | it in "docker run".
db_1_85f5f1d1343c | ****************************************************
db_1_85f5f1d1343c | waiting for server to start....2018-11-17 12:02:13.692 UTC [44] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1_85f5f1d1343c | 2018-11-17 12:02:13.884 UTC [45] LOG: database system was shut down at 2018-11-17 12:02:11 UTC
db_1_85f5f1d1343c | 2018-11-17 12:02:13.954 UTC [44] LOG: database system is ready to accept connections
db_1_85f5f1d1343c | done
db_1_85f5f1d1343c | server started
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | waiting for server to shut down....2018-11-17 12:02:13.995 UTC [44] LOG: received fast shutdown request
db_1_85f5f1d1343c | 2018-11-17 12:02:14.040 UTC [44] LOG: aborting any active transactions
db_1_85f5f1d1343c | 2018-11-17 12:02:14.043 UTC [44] LOG: worker process: logical replication launcher (PID 51) exited with exit code 1
db_1_85f5f1d1343c | 2018-11-17 12:02:14.043 UTC [46] LOG: shutting down
db_1_85f5f1d1343c | 2018-11-17 12:02:14.337 UTC [44] LOG: database system is shut down
db_1_85f5f1d1343c | done
db_1_85f5f1d1343c | server stopped
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | PostgreSQL init process complete; ready for start up.
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | 2018-11-17 12:02:14.454 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1_85f5f1d1343c | 2018-11-17 12:02:14.454 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1_85f5f1d1343c | 2018-11-17 12:02:14.554 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1_85f5f1d1343c | 2018-11-17 12:02:14.712 UTC [53] LOG: database system was shut down at 2018-11-17 12:02:14 UTC
db_1_85f5f1d1343c | 2018-11-17 12:02:14.760 UTC [1] LOG: database system is ready to accept connections
db_1_85f5f1d1343c | 2018-11-17 12:13:15.977 UTC [62] LOG: could not send data to client: Broken pipe
db_1_85f5f1d1343c | 2018-11-17 12:13:15.977 UTC [62] STATEMENT: SELECT t.oid, t.typname, t.typsend, t.typreceive, t.typoutput, t.typinput,
db_1_85f5f1d1343c | coalesce(d.typelem, t.typelem), coalesce(r.rngsubtype, 0), ARRAY (
db_1_85f5f1d1343c | SELECT a.atttypid
db_1_85f5f1d1343c | FROM pg_attribute AS a
db_1_85f5f1d1343c | WHERE a.attrelid = t.typrelid AND a.attnum > 0 AND NOT a.attisdropped
db_1_85f5f1d1343c | ORDER BY a.attnum
db_1_85f5f1d1343c | )
db_1_85f5f1d1343c | FROM pg_type AS t
db_1_85f5f1d1343c | LEFT JOIN pg_type AS d ON t.typbasetype = d.oid
db_1_85f5f1d1343c | LEFT JOIN pg_range AS r ON r.rngtypid = t.oid OR (t.typbasetype <> 0 AND r.rngtypid = t.typbasetype)
db_1_85f5f1d1343c |
db_1_85f5f1d1343c |
db_1_85f5f1d1343c | 2018-11-17 12:13:15.977 UTC [62] FATAL: connection to client lost
db_1_85f5f1d1343c | 2018-11-17 12:13:15.977 UTC [62] STATEMENT: SELECT t.oid, t.typname, t.typsend, t.typreceive, t.typoutput, t.typinput,
db_1_85f5f1d1343c | coalesce(d.typelem, t.typelem), coalesce(r.rngsubtype, 0), ARRAY (
db_1_85f5f1d1343c | SELECT a.atttypid
db_1_85f5f1d1343c | FROM pg_attribute AS a
db_1_85f5f1d1343c | WHERE a.attrelid = t.typrelid AND a.attnum > 0 AND NOT a.attisdropped
db_1_85f5f1d1343c | ORDER BY a.attnum
db_1_85f5f1d1343c | )
db_1_85f5f1d1343c | FROM pg_type AS t
db_1_85f5f1d1343c | LEFT JOIN pg_type AS d ON t.typbasetype = d.oid
db_1_85f5f1d1343c | LEFT JOIN pg_range AS r ON r.rngtypid = t.oid OR (t.typbasetype <> 0 AND r.rngtypid = t.typbasetype)
db_1_85f5f1d1343c |
db_1_85f5f1d1343c |
app_1_5fc54ca2d440 | [info] Application hello exited: Hello.Application.start(:normal, []) returned an error: shutdown: failed to start child: HelloWeb.Endpoint
app_1_5fc54ca2d440 | ** (EXIT) an exception was raised:
app_1_5fc54ca2d440 | ** (UndefinedFunctionError) function Plug.Cowboy.child_spec/1 is undefined (module Plug.Cowboy is not available)
app_1_5fc54ca2d440 | Plug.Cowboy.child_spec([scheme: :http, plug: {HelloWeb.Endpoint, []}, options: [dispatch: [: [{"/phoenix/live_reload/socket/websocket", Phoenix.Endpoint.CowboyWebSocket, {Phoenix.Transports.WebSocket, {HelloWeb.Endpoint, Phoenix.LiveReloader.Socket, [path: "/websocket", serializer: [{Phoenix.Socket.V1.JSONSerializer, "> 1.0.0"}, {Phoenix.Socket.V2.JSONSerializer, "> 2.0.0"}], timeout: 60000, transport_log: false, compress: false]}}}, {"/socket/websocket", Phoenix.Endpoint.CowboyWebSocket, {Phoenix.Transports.WebSocket, {HelloWeb.Endpoint, HelloWeb.UserSocket, [path: "/websocket", serializer: [{Phoenix.Socket.V1.JSONSerializer, "> 1.0.0"}, {Phoenix.Socket.V2.JSONSerializer, "> 2.0.0"}], timeout: 60000, transport_log: false, compress: false]}}}, {:, Plug.Adapters.Cowboy.Handler, {HelloWeb.Endpoint, []}}]], port: 4000, otp_app: :hello]])
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/cowboy_adapter.ex:96: Phoenix.Endpoint.CowboyAdapter.child_spec/3
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/supervisor.ex:106: anonymous fn/6 in Phoenix.Endpoint.Supervisor.server_children/4
app_1_5fc54ca2d440 | (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/supervisor.ex:97: Phoenix.Endpoint.Supervisor.server_children/4
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/supervisor.ex:57: Phoenix.Endpoint.Supervisor.init/1
app_1_5fc54ca2d440 | (stdlib) supervisor.erl:294: :supervisor.init/1
app_1_5fc54ca2d440 | (stdlib) gen_server.erl:365: :gen_server.init_it/2
app_1_5fc54ca2d440 | (stdlib) gen_server.erl:333: :gen_server.init_it/6
app_1_5fc54ca2d440 | (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
app_1_5fc54ca2d440 | ** (Mix) Could not start application hello: Hello.Application.start(:normal, []) returned an error: shutdown: failed to start child: HelloWeb.Endpoint
app_1_5fc54ca2d440 | ** (EXIT) an exception was raised:
app_1_5fc54ca2d440 | ** (UndefinedFunctionError) function Plug.Cowboy.child_spec/1 is undefined (module Plug.Cowboy is not available)
app_1_5fc54ca2d440 | Plug.Cowboy.child_spec([scheme: :http, plug: {HelloWeb.Endpoint, []}, options: [dispatch: [: [{"/phoenix/live_reload/socket/websocket", Phoenix.Endpoint.CowboyWebSocket, {Phoenix.Transports.WebSocket, {HelloWeb.Endpoint, Phoenix.LiveReloader.Socket, [path: "/websocket", serializer: [{Phoenix.Socket.V1.JSONSerializer, "> 1.0.0"}, {Phoenix.Socket.V2.JSONSerializer, "> 2.0.0"}], timeout: 60000, transport_log: false, compress: false]}}}, {"/socket/websocket", Phoenix.Endpoint.CowboyWebSocket, {Phoenix.Transports.WebSocket, {HelloWeb.Endpoint, HelloWeb.UserSocket, [path: "/websocket", serializer: [{Phoenix.Socket.V1.JSONSerializer, "> 1.0.0"}, {Phoenix.Socket.V2.JSONSerializer, "> 2.0.0"}], timeout: 60000, transport_log: false, compress: false]}}}, {:, Plug.Adapters.Cowboy.Handler, {HelloWeb.Endpoint, []}}]], port: 4000, otp_app: :hello]])
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/cowboy_adapter.ex:96: Phoenix.Endpoint.CowboyAdapter.child_spec/3
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/supervisor.ex:106: anonymous fn/6 in Phoenix.Endpoint.Supervisor.server_children/4
app_1_5fc54ca2d440 | (elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/supervisor.ex:97: Phoenix.Endpoint.Supervisor.server_children/4
app_1_5fc54ca2d440 | (phoenix) lib/phoenix/endpoint/supervisor.ex:57: Phoenix.Endpoint.Supervisor.init/1
app_1_5fc54ca2d440 | (stdlib) supervisor.erl:294: :supervisor.init/1
app_1_5fc54ca2d440 | (stdlib) gen_server.erl:365: :gen_server.init_it/2
app_1_5fc54ca2d440 | (stdlib) gen_server.erl:333: :gen_server.init_it/6
app_1_5fc54ca2d440 | (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
phoenix_app_1_5fc54ca2d440 exited with code 1

Auto Reload not working

I followed the instruction and ran this in devcontainer. However, auto reload does not work if i make any changes in heex file. The change does get reflected when i refresh the browser. I have tried using file_systems: [poll: true] without a result

Getting error while using git with Github Codespace

I started a codespaces from this repo and tried git status and getting this error below

> git status
warning: unable to access '/root/.gitconfig': Is a directory
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Switch to hexpm/elixir and Fuly Qualified Tag Names

I really like being able to specify the version of every piece of the runtime (elixir, erlang and linux). The official elixir docker image does not tag images with this much information.

However, the hexpm/elixir images do provide this information in the tags. May I suggest that we switch to those images, and provide more detailed tag names on the nicbet images? We should actually even make the tag names longer and include the Node version (which is already parameterized along with the phoenix version).

If this makes sense, I can work on a PR for the dockerfile, but I don't believe I'm able to do the CI work.

Version management of project in the src folder

I'm at this point where I'm having trouble organising the content inside the src folder.

There's 2 options:

  1. Treat each phoenix project with docker-phoenix as part of the skeleton codebase
  2. Treat docker-phoenix as a separate project and have ./src symlinked via some means into ./docker-phoenix/

Both these options are viable and are at play in similar offerings like laradock.

Let me know what you think and I'll PR accordingly.

Where to find the phoenix:1.3.0 image?

First off thanks for sharing this setup!

I'm just curious to know where the phoenix:1.3.0 image that is specified in the docker-compose.yml can be found. I didn't see anything on docker hub for phoenix but I'm assuming that because it doesn't come with a user handle prepended it must be official.

Build step doesn't finish on downloading docker layer

hi, i got a problem when following the readme, but i can't finish the build step. here are the result as bellow:

$ ./mix phx.new . --app hello
Pulling db (postgres:10)...
10: Pulling from library/postgres
a5a6f2f73cd8: Already exists
e50fbea8af5a: Already exists
73b4855ad326: Already exists
39616673f22b: Already exists
94e1b79f69ee: Downloading [==========> ] 1.359MB/6.183MB

i can't finish this downloading.
so, what can i do , switch to another mirror ?

is there anything wrong? i am in win10 and i use docker-terminal mode to excute the script.

Originally posted by @gofighting123 in #11 (comment)

build Problem: ./mix ecto.create

the error are as below:

01:26:10.026 [error] GenServer #PID<0.214.0> terminating
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
    (db_connection) lib/db_connection/connection.ex:84: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn't be created: killed

so, when i meet the problem, i just start another image with the follow command to map the localhost:5432 to my pc, and i use db tool and i success get the conntection. but there are no any table there.( i mean it's just empty table but only one postgres database and schema public )

$ docker run -p 5432:5432 6eb6c50a02e7
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint stoic_villani (6449c11d0dd9849f528db3089e67f1bd2c046026fcfdacc3eed4566086b15bc7): Bind for 0.0.0.0:5432 failed: port is already allocated.

user@DESKTOP-LPOFDEQ MINGW64 /c/Program Files/Docker Toolbox
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
a89fa7193099        6eb6c50a02e7        "docker-entrypoint.s…"   About a minute ago   Up About a minute   0.0.0.0:5432->5432/tcp   vigorous_lalande
b836829fdd30        postgres:10         "docker-entrypoint.s…"   18 hours ago         Up 2 minutes        5432/tcp                 hello-phoenix_db_1

so, is there something wrong with the README step, i can't start the web at localhost:4000 :(

How to pass env vars like MIX_ENV=prod?

Is there a way to pass env vars like MIX_ENV=prod?

What I did was to make a duplicate of run -> runprod and modify that file with -e MIX_ENV=prod. Then I made mixprod which calls runprod. The problem is this is super hard-coded for this specific case and so it's just a workaround.

Ideally we could pass parameters to docker-compose somehow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.