All Projects → bitwalker → Alpine Elixir Phoenix

bitwalker / Alpine Elixir Phoenix

Licence: mit
An Alpine Linux base image containing Elixir, Erlang, Node, Hex, and Rebar. Ready for Phoenix applications!

Labels

Projects that are alternatives of or similar to Alpine Elixir Phoenix

Jenkins X Platform
Helm umbrella repo containing the helm charts for the Jenkins-X platform on Kubernetes
Stars: ✭ 287 (-10.31%)
Mutual labels:  makefile
Awesome Servicemesh
Awesome service mesh - https://www.servicemesher.com/awesome-servicemesh/
Stars: ✭ 302 (-5.62%)
Mutual labels:  makefile
Full Speed Python
Full Speed Python: a book for self-learners
Stars: ✭ 3,447 (+977.19%)
Mutual labels:  makefile
Awesome Micropython
A curated list of awesome MicroPython libraries, frameworks, software and resources.
Stars: ✭ 287 (-10.31%)
Mutual labels:  makefile
Ghb0t
A GitHub Bot to automatically delete your fork's branches after a pull request has been merged.
Stars: ✭ 295 (-7.81%)
Mutual labels:  makefile
Archlinux Docker
Docker Base Image for Arch Linux (read-only mirror)
Stars: ✭ 304 (-5%)
Mutual labels:  makefile
Dockermail
Ready-to-use email server + (optional) web mail + (optional) caldav, carddav and a kitchen sink in a docker container
Stars: ✭ 286 (-10.62%)
Mutual labels:  makefile
Ios Project Env Setup
Setup your iOS project environment with a Shellscript, Makefile or Rakefile
Stars: ✭ 320 (+0%)
Mutual labels:  makefile
Trkdb
Stars: ✭ 299 (-6.56%)
Mutual labels:  makefile
Hadoop Book
Example source code accompanying O'Reilly's "Hadoop: The Definitive Guide" by Tom White
Stars: ✭ 3,317 (+936.56%)
Mutual labels:  makefile
Openwrt Shadowsocks
Shadowsocks-libev for OpenWrt/LEDE
Stars: ✭ 3,091 (+865.94%)
Mutual labels:  makefile
Reason Cli
Globally installable Reason toolchain.
Stars: ✭ 294 (-8.12%)
Mutual labels:  makefile
Task
A task runner / simpler Make alternative written in Go
Stars: ✭ 4,282 (+1238.13%)
Mutual labels:  makefile
Election Geodata
Precinct shapes (and vote results) for US elections past, present, and future
Stars: ✭ 289 (-9.69%)
Mutual labels:  makefile
React Fatigue Dev
Module of modules for making modules
Stars: ✭ 317 (-0.94%)
Mutual labels:  makefile
Learninglinuxkernel
和我一起学习Linux内核吧
Stars: ✭ 288 (-10%)
Mutual labels:  makefile
Tucl
The first-ever paper on the Unix shell written by Ken Thompson in 1976 scanned, transcribed, and redistributed with permission
Stars: ✭ 303 (-5.31%)
Mutual labels:  makefile
Helm Doc Zh Cn
Try to translate the helm official docs to Chinese. Helm官方文档中文翻译。如果大家觉得这个项目还可以,麻烦打一下右上角的Star按钮,谢谢。此网址查看更方便,欢迎大家提bug,
Stars: ✭ 319 (-0.31%)
Mutual labels:  makefile
Iso
Pop!_OS ISO production
Stars: ✭ 318 (-0.62%)
Mutual labels:  makefile
Monolinux
Create embedded Linux systems with a single statically linked executable.
Stars: ✭ 314 (-1.87%)
Mutual labels:  makefile

Elixir/Phoenix on Alpine Linux

This Dockerfile provides everything you need to run your Phoenix application in Docker out of the box.

It is based on my alpine-erlang image, and installs Elixir (1.11.0), Node.js (12.18.x), Hex and Rebar. It can handle compiling your Node and Elixir dependencies as part of it's build.

Usage

NOTE: This image is intended to run in unprivileged environments, it sets the home directory to /opt/app, and makes it globally read/writeable. If run with a random, high-index user account (say 1000001), the user can run an app, and that's about it. If run with a user of your own creation, this doesn't apply (necessarily, you can of course implement the same behaviour yourself). It is highly recommended that you add a USER default instruction to the end of your Dockerfile so that your app runs in a non-elevated context.

To boot straight to a prompt in the image:

$ docker run --rm -it --user=1000001 bitwalker/alpine-elixir-phoenix iex
Erlang/OTP 23 [erts-11.1.1] [source] [64-bit] [smp:3:3] [ds:3:3:10] [async-threads:1]

Interactive Elixir (1.11.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

Extending for your own application:

FROM bitwalker/alpine-elixir-phoenix:latest

# Set exposed ports
EXPOSE 5000
ENV PORT=5000 MIX_ENV=prod

# Cache elixir deps
ADD mix.exs mix.lock ./
RUN mix do deps.get, deps.compile

# Same with npm deps
ADD assets/package.json assets/
RUN cd assets && \
    npm install

ADD . .

# Run frontend build, compile, and digest assets
RUN cd assets/ && \
    npm run deploy && \
    cd - && \
    mix do compile, phx.digest

USER default

CMD ["mix", "phx.server"]

It is recommended when using this that you have the following in .dockerignore when running docker build:

_build
deps
assets/node_modules
test

This will keep the payload smaller and will also avoid any issues when compiling dependencies.

Multistage Docker Builds

You can also leverage docker multistage build and bitwalker/alpine-elixir to lower your image size significantly.

An example is shown below:

FROM bitwalker/alpine-elixir-phoenix:latest AS phx-builder

# Set exposed ports
ENV MIX_ENV=prod

# Cache elixir deps
ADD mix.exs mix.lock ./
RUN mix do deps.get, deps.compile

# Same with npm deps
ADD assets/package.json assets/
RUN cd assets && \
    npm install

ADD . .

# Run frontend build, compile, and digest assets
RUN cd assets/ && \
    npm run deploy && \
    cd - && \
    mix do compile, phx.digest

FROM bitwalker/alpine-elixir:latest

EXPOSE 5000
ENV PORT=5000 MIX_ENV=prod

COPY --from=phx-builder /opt/app/_build /opt/app/_build
COPY --from=phx-builder /opt/app/priv /opt/app/priv
COPY --from=phx-builder /opt/app/config /opt/app/config
COPY --from=phx-builder /opt/app/lib /opt/app/lib
COPY --from=phx-builder /opt/app/deps /opt/app/deps
COPY --from=phx-builder /opt/app/.mix /opt/app/.mix
COPY --from=phx-builder /opt/app/mix.* /opt/app/

# alternatively you can just copy the whole dir over with:
# COPY --from=phx-builder /opt/app /opt/app
# be warned, this will however copy over non-build files

USER default

CMD ["mix", "phx.server"]

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].