├── docker-compose.yml ├── LICENSE.md ├── Dockerfile └── README.md /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | db: 4 | image: postgres:9.6.2 5 | ports: 6 | - "5432:5432" 7 | environment: 8 | - POSTGRES_USER=postgres 9 | - POSTGRES_PASSWORD=postgres 10 | api: 11 | image: ilkerguller/phoenix:latest 12 | command: mix phoenix.server 13 | environment: 14 | - DOCKER=true 15 | volumes: 16 | - .:/app 17 | ports: 18 | - "4000:4000" 19 | depends_on: 20 | - db 21 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Ilker Guller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM elixir:1.4.2 2 | 3 | MAINTAINER Ilker Guller 4 | 5 | # System Env's 6 | ENV REFRESHED_AT 2017-04-05 7 | ENV ELIXIR_VERSION 1.4.2 8 | ENV PHOENIX_VERSION 1.2.1 9 | ENV NODE_VERSION 7 10 | ENV PATH $PATH:node_modules/.bin:/opt/elixir-$ELIXIR_VERSION/bin 11 | 12 | # Install System Dependencies + Nodejs 13 | RUN apt-get update -q && apt-get upgrade -y \ 14 | && apt-get install -y apt-transport-https curl wget git make sudo locales locales-all ca-certificates \ 15 | && apt-get update -q \ 16 | && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | sudo -E bash - \ 17 | && sudo apt-get install -y nodejs \ 18 | && apt-get clean -y \ 19 | && rm -rf /var/cache/apt/* 20 | 21 | # Create Certificate 22 | RUN mkdir -p /etc/ssl/certs \ 23 | && sudo update-ca-certificates 24 | 25 | # Elixir requires UTF-8 26 | RUN locale-gen en_US.UTF-8 27 | ENV LANG en_US.UTF-8 28 | ENV LANGUAGE en_US:en 29 | ENV LC_ALL en_US.UTF-8 30 | 31 | # Install Required NPM Packages 32 | RUN npm install -g yarn 33 | 34 | # Install Hex + Rebar + Phoenix 35 | RUN mix local.hex --force \ 36 | && mix local.rebar --force \ 37 | && mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new-$PHOENIX_VERSION.ez --force 38 | 39 | WORKDIR /app 40 | # ONBUILD ENV MIX_ENV prod 41 | 42 | ONBUILD COPY mix.* /app/ 43 | ONBUILD RUN mix deps.get 44 | # ONBUILD RUN mix deps.get --only prod 45 | 46 | ONBUILD COPY package.json /app/ 47 | ONBUILD RUN npm install 48 | 49 | ONBUILD COPY config /app/config/ 50 | ONBUILD RUN mix deps.compile 51 | # ONBUILD RUN mix deps.compile --only prod 52 | 53 | ONBUILD COPY . /app/ 54 | ONBUILD RUN mix compile 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Phoenix-Docker 2 | ## A Docker container for the Phoenix framework 3 | 4 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 5 | [![Docker Stars](https://img.shields.io/docker/stars/ilkerguller/phoenix.svg)](https://hub.docker.com/r/ilkerguller/phoenix/) 6 | [![Docker Pulls](https://img.shields.io/docker/pulls/ilkerguller/phoenix.svg)](https://hub.docker.com/r/ilkerguller/phoenix/) 7 | 8 | This image is based on the [official Elixir image](https://hub.docker.com/_/elixir/) and includes the features of that image. 9 | 10 | [Click here to open docker hub link](https://hub.docker.com/r/ilkerguller/phoenix/) 11 | 12 | ### Image Contents (updated: 05/04/2017) 13 | 14 | - Elixir 1.4.2 15 | - Phoenix 1.2.1 16 | - Node JS 7.x 17 | - Yarn (NPM) 18 | 19 | ### Image Versions 20 | 21 | The 'latest' tag on Docker Hub should always be reasonably in sync with the tip of 'master' within this repository via automated builds. 22 | 23 | ### How to use this image 24 | 25 | ``` 26 | docker run -it -v "$PWD":/app ilkerguller/phoenix:latest 27 | ``` 28 | 29 | ### To prepare Docker-compose: 30 | 31 | - docker-compose up -d 32 | - docker-compose run api mix deps.get 33 | - docker-compose run api mix ecto.create 34 | - docker-compose run api mix ecto.migrate 35 | - docker-compose run api npm install 36 | 37 | ### Use after prepare 38 | 39 | - docker-compose up -d 40 | 41 | ### Authors 42 | 43 | * **Ilker Guller** - [website](http://ilkerguller.com) / [twitter](https://twitter.com/the_bluescreen) 44 | 45 | See also the list of [contributors](https://github.com/Sly777/phoenix-docker/contributors) who participated in this project. 46 | 47 | ### License 48 | 49 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 50 | --------------------------------------------------------------------------------