From 5fb35ac504c3fbe4316820095ad4c8ccfdd6a258 Mon Sep 17 00:00:00 2001 From: Nicolas Bettenburg Date: Fri, 24 Sep 2021 13:33:29 -0400 Subject: [PATCH] Update to Phoenix Framework 1.6.0 --- .devcontainer/Dockerfile | 2 +- Dockerfile | 4 ++-- README.md | 31 +++++++++++++++++++++++++++---- build.sh | 2 +- docker-compose.yml | 4 ++-- run | 4 ++-- 6 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 01fa981..8e16948 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM nicbet/phoenix:1.5.12 +FROM nicbet/phoenix:1.6.0 RUN apt-get install -y ruby \ && gem install --no-ri --no-rdoc htmlbeautifier \ diff --git a/Dockerfile b/Dockerfile index 0cb28e5..57e0f97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM elixir:1.12.2 +FROM elixir:1.12.3 MAINTAINER Nicolas Bettenburg RUN mix local.hex --force \ - && mix archive.install --force hex phx_new 1.5.12 \ + && mix archive.install --force hex phx_new 1.6.0 \ && apt-get update \ && curl -sL https://deb.nodesource.com/setup_12.x | bash \ && apt-get install -y apt-utils \ diff --git a/README.md b/README.md index 2d09328..d3dd1a1 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,10 @@ It's so simple: just clone this repository. You can specify a particular Phoenix version by targeting the corresponding release tag of this repository. -For instance, for a dockerized development environment for Phoenix 1.5.12 you could run: +For instance, for a dockerized development environment for Phoenix 1.6.0 you could run: ``` -git clone -b 1.5.12 https://github.com/nicbet/docker-phoenix ~/Projects/hello-phoenix +git clone -b 1.6.0 https://github.com/nicbet/docker-phoenix ~/Projects/hello-phoenix ``` ### New with Elixir 1.9: Releases @@ -103,13 +103,36 @@ If you copied an existing application, now would be the time to run your databas ### Starting the Application -Starting your application is incredibly easy: +Starting your application is incredibly easy, you can either run: ``` docker-compose up ``` -Once up, it will be available under http://localhost:4000 +or + +``` +./mix phx.server +``` + +Once up, it will be available under http://localhost:4000. + +You may need to update `config/dev.exs` and set the endpoint listen address to `0.0.0.0` like so: + +``` +config :hello_world, HelloWorldWeb.Endpoint, + # Binding to loopback ipv4 address prevents access from other machines. + # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. + http: [ip: {0, 0, 0, 0}, port: 4000], + check_origin: false, + code_reloader: true, + debug_errors: true, + secret_key_base: "rM/QJOrRiW+3WWLw+lHJ8kUFJK/LTrwakSG/ftGYl8jYN0FKqfgS50l2C9BdKMoK", + watchers: [ + # Start the esbuild watcher by calling Esbuild.install_and_run(:default, args) + esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]} + ] +``` ## Notes diff --git a/build.sh b/build.sh index 83c849c..91120b3 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,2 @@ #!/bin/sh -docker build -t nicbet/phoenix:1.5.12 . +docker build -t nicbet/phoenix:1.6.0 . diff --git a/docker-compose.yml b/docker-compose.yml index d1f3e5f..b312092 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "2" services: app: - image: nicbet/phoenix:1.5.12 + image: nicbet/phoenix:1.6.0 build: . ports: - "4000:4000" @@ -15,7 +15,7 @@ services: depends_on: - db db: - image: postgres:10 + image: postgres:12 environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres diff --git a/run b/run index 2575a56..24aa713 100755 --- a/run +++ b/run @@ -1,3 +1,3 @@ #!/usr/bin/env bash -docker-compose run --rm app $@ -docker-compose run --rm app chown -R $(id -u):$(id -g) . +docker-compose run --service-ports --rm app $@ +docker-compose run --service-ports --rm app chown -R $(id -u):$(id -g) .