Last active
January 28, 2020 21:32
-
-
Save mschae/8699e08c0b56493619c62e37a9f28e78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.4" | |
services: | |
app: | |
build: | |
context: "." | |
target: app | |
args: | |
ENV: dev | |
environment: | |
DATABASE_URL: "psql://postgres:postgres@db/app" | |
ports: | |
- "4000:4000" | |
volumes: | |
- "app:/app" | |
command: mix do deps.get, ecto.migrate, phx.server | |
assets: | |
build: | |
context: "." | |
target: assets | |
command: sh -c "npm install && npm run watch" | |
volumes: | |
- "app:/app" | |
db: | |
image: postgres:10 | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: app | |
sync: | |
image: cweagans/bg-sync | |
volumes: | |
- ".:/source" | |
- "app:/destination" | |
environment: | |
SYNC_EXTRA_UNISON_PROFILE_OPTS: | | |
ignore = Path assets/node_modules/* | |
ignore = Path _build/* | |
volumes: | |
app: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12.2-slim as assets | |
WORKDIR /app/assets | |
COPY assets/package*.json ./ | |
RUN npm install | |
# Copy the entire app so we can put files into /app/priv/static | |
COPY . /app | |
RUN npm run deploy | |
FROM elixir:1.8.1-slim as app | |
RUN apt-get update && \ | |
apt-get install -y inotify-tools && \ | |
rm -rf /var/lib/apt/lists/* | |
WORKDIR /app | |
RUN mix local.hex --force | |
RUN mix local.rebar --force | |
ARG ENV=dev | |
ENV ENV $ENV | |
COPY mix.* ./ | |
RUN mix deps.get | |
RUN mix deps.compile | |
COPY . . | |
RUN mix compile | |
COPY --from=assets /app/priv/static/* /app/priv/static/ | |
RUN mix phx.digest | |
CMD mix phx.server | |
# TODO: Add packaging once elixir 1.9 is released |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment