Created
July 13, 2022 22:59
-
-
Save kenichi/290faa6bb37283ce52bd34c6671cd920 to your computer and use it in GitHub Desktop.
dockerfile and compose for local dev with elixir:alpine
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.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: |
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 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