Skip to content

Instantly share code, notes, and snippets.

@Namek
Created December 6, 2017 00:08
Show Gist options
  • Save Namek/0431dce8cba39019fd3c0a088b5b880a to your computer and use it in GitHub Desktop.
Save Namek/0431dce8cba39019fd3c0a088b5b880a to your computer and use it in GitHub Desktop.
Docker compose: elixir-node@ubuntu + postgres@alpine
version: '2.1'
services:
db:
image: postgres:alpine
ports:
- "8081:5432"
environment:
- POSTGRES_PASSWORD=postgres
web:
build: .
ports:
- "8080:8080"
links:
- "db:database"
depends_on:
- db
restart: always
FROM elixir:1.5
EXPOSE 8080
ENV PORT=8080 MIX_ENV=prod
ENV LANG=C.UTF-8
RUN apt-get update && mix local.hex --force && mix local.rebar --force
# Install node.js and Elm
RUN curl -sL https://deb.nodesource.com/setup_8.x \
| bash - && apt-get install -y nodejs openssl \
&& rm -rf /var/lib/apt/lists/* \
&& npm i -g yarn \
&& npm install -g elm --unsafe-perm=true --allow-root
# Cache Elm deps
ADD assets/elm/elm-package.json ./assets/elm/elm-package.json
RUN cd assets/elm && elm-package install --yes && cd ../..
# Cache Elixir deps
ADD mix.exs mix.lock ./
RUN mix do deps.get, deps.compile
# Cache npm deps
ADD assets/package.json assets/package.json
RUN cd assets && yarn && cd ..
ADD . .
WORKDIR .
ENTRYPOINT mix do ecto.create, ecto.migrate, phx.server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment