• Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Docker development environment for Elixir+Phoenix

Elixir / Phoenix containerized development environment

This repo contains simple boilerplate files that can be added to any Phoenix application so you may run it and its database inside Docker containers using Docker Compose.

What you get

  • One-line dev environment setup: docker-compose up. This command creates the database, does the Dialyzer pre-work (if the project has Dialyxer installed), and everything else.
  • Developer-friendly setup: Source code is mounted so that changes in the container appear on the host and vice-versa.
  • Fast re-builds because the Dockerfile is written to help Docker cache the images.
  • Syncing with Postgres startup delay.
  • All the crappy little dependencies installed.
  • No weird hacks.

Uses Elixir 1.9.4 (compatible with Phoenix 1.4), and latest Postgres.

Instructions

  1. Copy the three files (Dockerfile, docker-compose.yml, and run.sh) to an existing Phoenix project which you want to Dockerize.
  2. Make run.sh executable, e.g. chmod +x run.sh
  3. Edit the database connection settings for the environments which will use this setup (usually dev.exs and test.exs). You can hard-code the credentials for the relevant environment(s) to reference the hostname of db, a username of postgres, and an empty password, or you can specify environment-variable overrides like the following:
# Inside config/dev.ex and/or config/test.exs
config :my_app, MyApp.Repo,
  hostname: System.get_env("DB_HOST", "localhost"),
  password: System.get_env("DB_PASS", "postgres"),
  # ... etc...
  1. Spin it up with docker-compose up.

Usage

Tests can be run in the container like so:

docker-compose run web mix test

Or, for a slightly faster startup time,

docker-compose exec web mix test

... I haven't found a disadvantage of re-using the running container this way.

More Repositories

1

asset_ram

Reduce Rails allocations by 35%+ and gain a speed boost. Memoizes asset links.
Ruby
177
star
2

naturally

Natural sort algorithm
Ruby
86
star
3

rspec-webservice_matchers

Black-box web app testing
Ruby
79
star
4

repo-health-check

Analyze a project: How are the maintainers doing?
CoffeeScript
75
star
5

validated_object

Self-validating Ruby objects
Ruby
60
star
6

schema-dot-org

Easy structured data for websites. All validated for syntax and semantics. Simple declarative-style coding.
Ruby
54
star
7

rails-docker-compose

Docker development environment for Ruby on Rails
Shell
51
star
8

raspberry-pi-python-github-runner

Sample configuration for using Raspberry Pi's as Python Github Runners
Python
21
star
9

non_empty_array

An ordered list guaranteed to have at least one element
Ruby
21
star
10

digbang

Safer Ruby hash and array traversal
Ruby
9
star
11

yahboom-raspi-cooling-fan

Code and help for the Yahboom Raspberry Pi Cooling Fan with RGB and OLED display
Python
9
star
12

forkful

An open-content programming cookbook. A responsible use of AI proof of concept. Collaborative, polyglot and multilingual.
Ruby
9
star
13

language-comparison

A GraphQL server prototyped in many languages
Python
5
star
14

ketobit

Fitbit carb tracking
Elixir
5
star
15

mctop

Python CLI Memcached monitor
Python
4
star
16

python-exhaustiveness-adts-monads

Demo code showing off the new true exhaustiveness checks with Python 3.10 + Pyright
Python
4
star
17

Super-Cat-City-Alerts

A city alert notification system
Ruby
3
star
18

safe-to-upgrade

2
star
19

stable_profile

Run rspec --profile several times, averaging the results.
Ruby
2
star
20

HTTP-Assertions

Check web server configurations via Ruby test cases.
Ruby
1
star
21

seed-report

Simple reporting for Ruby on Rails seed files
Ruby
1
star
22

javafind

Unix find implemented in Java. Vintage code from 2004
HTML
1
star
23

beginning-programming-with-python

Jupyter Notebook
1
star
24

victor-hugo

JavaScript
1
star
25

python-enum-import-issue

Python Enums aren't singletons—demo
Python
1
star
26

curl_ex

Simple Elixir HTTP using curl
Elixir
1
star