Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ npm-debug.log
# we ignore priv/static. You may want to comment
# this depending on your deployment strategy.
/priv/static/

# Ignore .env files
*.env
4 changes: 4 additions & 0 deletions .local.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$xport POSTGRES_USER='swm'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo? $xport

export POSTGRES_PASSWORD=''
export POSTGRES_DB='website_dev'
export POSTGRES_HOST='localhost'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, was this file intended to be committed?

30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM elixir:1.9.4-alpine

MAINTAINER Stephen McCullough <stephen.mccullough@gmail.com>

RUN apk add postgresql-client
RUN apk add nodejs
RUN apk add --update npm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we install inotify-tools, we get automatic page reload on code changes.



ADD . /app
WORKDIR /app

RUN mkdir -p /app/assets
WORKDIR /app

ENV NODE_ENV=development

COPY assets/package.json assets/package-lock.json ./assets/
COPY deps/phoenix deps/phoenix
COPY deps/phoenix_html deps/phoenix_html

RUN mix local.hex --force
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should come before line 10 (which copies the code onto the image). This way, a code change doesn't bust the image cache.


RUN cd assets && npm install
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here. Moving npm install to before copying the code (separating copying the code and copying the package*.json files) would avoid busting the cache on every code change.


# build assets
COPY assets ./assets/

EXPOSE 4000
CMD ["./run.sh"]
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ The website will then injest this API.

## Developing

To start the app:
### Natively


* export your env vars via `local.env.template` (this isn't loaded so amend, copy, paste and execute).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could instruct users to do source local.env.template.

* `mix deps.get`
* `mix ecto.setup`
* `cd assets && npm install`
* `mix phx.server`

### Docker

* `docker-compose build`
* `docker-compose up`

Visit [`localhost:4000`](http://localhost:4000).

## Premise
Expand Down
Loading