mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-11-21 23:50:59 +00:00
Creates a docker-compose for ease of local standups.
This commit is contained in:
parent
f1908151f9
commit
294b229e48
3 changed files with 69 additions and 0 deletions
14
Dockerfile.dev
Normal file
14
Dockerfile.dev
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Used by docker-compose.yml
|
||||
FROM hexpm/elixir:1.12.0-erlang-24.0.1-debian-bullseye-20210902-slim
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential dialog apt-utils gpg-agent \
|
||||
apt-transport-https software-properties-common git curl postgresql-client inotify-tools && \
|
||||
mix local.hex --force && \
|
||||
mix archive.install hex phx_new 1.6.7 --force && \
|
||||
mix local.rebar --force && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
EXPOSE 4000
|
||||
CMD /bin/sh -c "while sleep 1000; do :; done"
|
|
@ -11,6 +11,30 @@ if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do
|
|||
config :live_beats, LiveBeatsWeb.Endpoint, server: true
|
||||
end
|
||||
|
||||
# Used by Dockerfile.dev.
|
||||
if System.get_env("DEV_CONTAINER") do
|
||||
database_url =
|
||||
System.get_env("DATABASE_URL") ||
|
||||
raise """
|
||||
environment variable DATABASE_URL is missing.
|
||||
For example: ecto://USER:PASS@HOST/DATABASE
|
||||
"""
|
||||
|
||||
replica_database_url =
|
||||
System.get_env("REPLICA_DATABASE_URL") || database_url
|
||||
|
||||
config :live_beats, LiveBeats.Repo,
|
||||
url: database_url,
|
||||
show_sensitive_data_on_connection_error: true,
|
||||
pool_size: 10
|
||||
|
||||
config :live_beats, LiveBeats.ReplicaRepo,
|
||||
url: replica_database_url,
|
||||
show_sensitive_data_on_connection_error: true,
|
||||
pool_size: 10,
|
||||
priv: "priv/repo"
|
||||
end
|
||||
|
||||
if config_env() == :prod do
|
||||
database_url =
|
||||
System.get_env("DATABASE_URL") ||
|
||||
|
|
31
docker-compose.yml
Normal file
31
docker-compose.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: "3"
|
||||
services:
|
||||
web:
|
||||
container_name: "live_beats_dev"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.dev
|
||||
environment:
|
||||
# Review the readme on how to register a github oauth app.
|
||||
LIVE_BEATS_GITHUB_CLIENT_ID: "FIX_ME"
|
||||
LIVE_BEATS_GITHUB_CLIENT_SECRET: "FIX_ME"
|
||||
DEV_CONTAINER: "true"
|
||||
DATABASE_URL: "ecto://postgres:postgres@db/live_beats_dev"
|
||||
depends_on:
|
||||
- db
|
||||
ports:
|
||||
- "4000:4000"
|
||||
db:
|
||||
container_name: "live_beats_data"
|
||||
image: "postgres:14.2"
|
||||
command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.max=10000 -c pg_stat_statements.track=all
|
||||
environment:
|
||||
POSTGRES_DB: "live_beats_dev"
|
||||
POSTGRES_HOST_AUTH_METHOD: "trust"
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- data:/var/lib/postgresql/data
|
||||
volumes:
|
||||
data:
|
||||
driver: local
|
Loading…
Reference in a new issue