Skip to content

Commit

Permalink
Add setup helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
thebugcatcher committed Oct 29, 2023
1 parent 7e79317 commit 8935327
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .demo/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3'
services:
web:
build:
context: ../
dockerfile: Dockerfile.demo
args:
- HEIMDALL_DB_HOST=db
- HEIMDALL_DB_USERNAME=postgres
- HEIMDALL_DB_PASSWORD=postgres
ports:
- "4000:4000"
depends_on:
- db
environment:
TERM: "xterm-256color"

db:
image: postgis/postgis:13-3.3-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- ../tmp/demo_postgresql:/var/lib/postgresql/data
35 changes: 35 additions & 0 deletions Dockerfile.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ARG MIX_ENV="dev"

FROM hexpm/elixir:1.14.4-erlang-26.0-alpine-3.17.3 as build

# install build dependencies
RUN apk add --no-cache build-base \
git \
python3 \
curl \
nodejs \
npm \
inotify-tools \
git

# prepare build dir
WORKDIR /app

COPY . .

# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force

RUN mix deps.get

ARG HEIMDALL_DB_HOST
ARG HEIMDALL_DB_USERNAME
ARG HEIMDALL_DB_PASSWORD
ENV HEIMDALL_DB_HOST=${HEIMDALL_DB_HOST}
ENV HEIMDALL_DB_USERNAME=${HEIMDALL_DB_USERNAME}
ENV HEIMDALL_DB_PASSWORD=${HEIMDALL_DB_PASSWORD}

RUN printenv

CMD ["mix", "phx.server"]
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ ifndef DC
$(error "docker-compose is not installed")
endif
$(docker_compose) --file .development/docker-compose.yml up --build -d --remove-orphans


demo:
ifndef DC
$(error "docker-compose is not installed")
endif
$(docker_compose) --file .demo/docker-compose.yml up --build --remove-orphans

setup:
ifndef DC
$(error "docker-compose is not installed")
endif
$(docker_compose) --file .demo/docker-compose.yml exec web mix ecto.setup

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ others.

This app was built as part of Spawnfest 2023 by a wife + husband team: Susan Walker and Adi Iyengar.
Susan has always been interested in Elixir and BEAM-based languages, and Adi being comfortable with
them thought it would be a fun couple's activity to try and build Heimdall at Spawsfest.
them thought it would be a fun couple's activity to try and build Heimdall at Spawnfest.

* [@thebugcatcher](https://github.com/thebugcatcher)
* [@susanwalker](https://github.com/susanwalker)
Expand Down

0 comments on commit 8935327

Please sign in to comment.