Skip to content

Instantly share code, notes, and snippets.

@coryf
Created September 1, 2016 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coryf/22cabf112a3d31bad77b959a2fa2da2c to your computer and use it in GitHub Desktop.
Save coryf/22cabf112a3d31bad77b959a2fa2da2c to your computer and use it in GitHub Desktop.
Phoenix + Docker Compose + Live Reload
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: "js/app.js"
// To use a separate vendor.js bundle, specify two files path
// http://brunch.io/docs/config#-files-
// joinTo: {
// "js/app.js": /^(web\/static\/js)/,
// "js/vendor.js": /^(web\/static\/vendor)|(deps)/
// }
//
// To change the order of concatenation of files, explicitly mention here
// order: {
// before: [
// "web/static/vendor/js/jquery-2.1.1.js",
// "web/static/vendor/js/bootstrap.min.js"
// ]
// }
},
stylesheets: {
joinTo: "css/app.css",
order: {
after: ["web/static/css/app.css"] // concat app.css last
}
},
templates: {
joinTo: "js/app.js"
}
},
conventions: {
// This option sets where we should place non-css and non-js assets in.
// By default, we set this to "/web/static/assets". Files in this directory
// will be copied to `paths.public`, which is "priv/static" by default.
assets: /^(web\/static\/assets)/
},
// Phoenix paths configuration
paths: {
// Dependencies and current project directories to watch
watched: [
"web/static",
"test/static"
],
// Where to compile files to
public: "priv/static"
},
// Configure your plugins
plugins: {
babel: {
presets: ["es2015", "es2016", "react", "stage-2"],
// Do not use ES6 compiler in vendor code
ignore: [/web\/static\/vendor/]
}
},
modules: {
autoRequire: {
"js/app.js": ["web/static/js/app"]
}
},
npm: {
enabled: true
}
};
version: '2'
services:
web:
build:
context: .
dockerfile: Dockerfile
env_file: .env # touch .env if you receive an error
command: mix phoenix.server
environment:
- MIX_ENV=dev
- PORT=4000
- PG_HOST=postgres
- PG_USERNAME=postgres
volumes:
- .:/app
ports:
- "4000:4000"
links:
- postgres
test:
image: <PROJECT_NAME>_web
env_file: .env # touch .env if you receive an error
command: mix test
environment:
- MIX_ENV=test
- PORT=4001
- PG_HOST=postgres
- PG_USERNAME=postgres
volumes_from:
- web
links:
- postgres
depends_on:
- web
postgres:
image: postgres:9.5 # https://hub.docker.com/_/postgres/
volumes:
- postgres-volume:/var/lib/postgresql/data/
expose:
- "5432"
volumes:
postgres-volume:
driver: local
# Starting from the official Elixir 1.3.2 image:
# https://hub.docker.com/_/elixir/
FROM elixir:1.3.2
# Based off of a Dockerfile by David Anguita <david@davidanguita.name>
MAINTAINER Cory Fabre <cfabre@gmail.com>
ENV DEBIAN_FRONTEND=noninteractive
# Install hex
RUN mix local.hex --force
# Install rebar
RUN mix local.rebar --force
# Install the Phoenix framework itself
RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez
# Install NodeJS 6.x and the NPM
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y -q nodejs
# Install inotify
RUN apt-get install -y -q inotify-tools
# Set /app as workdir
WORKDIR /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment