Skip to content

Instantly share code, notes, and snippets.

@kenichi
Created July 13, 2022 22:59
Show Gist options
  • Save kenichi/290faa6bb37283ce52bd34c6671cd920 to your computer and use it in GitHub Desktop.
Save kenichi/290faa6bb37283ce52bd34c6671cd920 to your computer and use it in GitHub Desktop.
dockerfile and compose for local dev with elixir:alpine
version: '3.9'
services:
app:
build:
args:
UID: ${UID}
USER: ${USER}
command: elixir -S mix phx.server
ports:
- 4000:4000
volumes:
- .:/app:cached
- build:/app/_build
- deps:/app/deps
- node_modules:/app/assets/node_modules
volumes:
build:
deps:
node_modules:
FROM elixir:1.13-alpine AS base
RUN apk add --no-cache \
bash \
inotify-tools \
nodejs npm \
openssl
WORKDIR /app
CMD ["mix", "phx.server"]
FROM base AS local
ARG UID
ARG USER
RUN adduser -u $UID -D -h /home/$USER -s /bin/bash $USER
RUN mkdir -p /app/_build && \
mkdir -p /app/deps && \
mkdir -p /app/assets/node_modules && \
chown -R $USER /app
USER $USER
# these install to user home dirs
RUN mix local.hex --force && \
mix local.rebar --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment