Skip to content

Instantly share code, notes, and snippets.

@johannesE
Last active May 26, 2017 16:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johannesE/7ee81d90d0934a70bd14350c562c9366 to your computer and use it in GitHub Desktop.
Save johannesE/7ee81d90d0934a70bd14350c562c9366 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
mix ecto.migrate
exec mix phoenix.server
version: '2'
services:
# the database image
db:
image: "postgres:9.6"
ports:
- "5432:5432"
environment:
POSTGRES_USER: "gottserver"
POSTGRES_PASSWORD: "asdf"
POSTGRES_DB: "gottserver_prod"
volumes:
- data:/var/lib/postgresql/data
# the main image, this is the application
web:
build: "."
environment:
MIX_ENV: "prod"
PORT: "80"
DB_USER: "gottserver"
DB_PASSWORD: "asdf"
ports:
- "80:80"
links:
- "db:db"
# for persistence of database data
volumes:
data:
external: true
FROM ubuntu:16.04
RUN locale-gen en_US.UTF-8
RUN locale-gen de_CH.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL de_CH.UTF-8
RUN apt-get update && apt-get install -y -q apt-transport-https wget build-essential # build -ssential includes make
# installing elixir
RUN wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && dpkg -i erlang-solutions_1.0_all.deb
RUN apt-get update && apt-get install -y --no-install-recommends esl-erlang elixir
# gottserver specific
ADD . /app
WORKDIR /app
RUN mix local.hex --force
RUN mix local.rebar --force
RUN mix deps.get --only-prod
RUN MIX_ENV=prod mix compile
CMD ./docker_cmd.sh
chmod +x docker_command.sh # one time deal
docker volume create --name=data # one time deal
docker-compose up -d --build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment