GithubHelp home page GithubHelp logo

beardedeagle / alpine-phoenix-builder Goto Github PK

View Code? Open in Web Editor NEW
73.0 4.0 6.0 63 KB

Up to date Alpine image with the latest language versions for staged Elixir and Phoenix builds.

License: MIT License

Makefile 56.02% Dockerfile 43.98%
docker alpine erlang elixir rebar rebar3 hex nodejs npm phoenix

alpine-phoenix-builder's Introduction

Docker + Alpine + Elixir && Phoenix = Love

This Dockerfile provides a good base build image to use in multistage builds for Elixir and Phoenix apps. It comes with the latest version of Alpine, Erlang, Elixir, Rebar, Hex, NodeJS and NPM. It is intended for use in creating release images with or for your application and allows you to avoid cross-compiling releases. The exception of course is if your app has NIFs which require a native compilation toolchain, but that is an exercise left to the user.

No effort has been made to make this image suitable to run in unprivileged environments. The repository owner is not responsible for any losses that result from improper usage or security practices, as it is expected that the user of this image will implement proper security practices themselves.

Software/Language Versions

Alpine 3.13.1
OTP/Erlang 23.2.3
Elixir 1.11.3
Rebar 3.14.3
Hex 0.21.1
Nodejs 15.8.0
NPM 7.5.2
Git 2.30.0

Usage

To boot straight to a iex prompt in the image:

$ docker run --rm -i -t beardedeagle/alpine-phoenix-builder iex
Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]

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

For your own application:

  • Using Elixir releases
FROM beardedeagle/alpine-phoenix-builder:1.11.3 as builder
ENV appdir /opt/test_app
WORKDIR ${appdir}
COPY . ${appdir}
RUN mix deps.get --only prod \
  && MIX_ENV=prod mix compile \
  && cd assets \
  && npm install \
  && node node_modules/webpack/bin/webpack.js --mode production \
  && cd ${appdir} \
  && MIX_ENV=prod mix phx.digest \
  && MIX_ENV=prod mix release \
  && V=0.1.0; pushd _build/prod/rel; tar -czvf ${appdir}/test_app-${V}.tar.gz test_app; popd;

FROM alpine:3.13.1
EXPOSE 4000
ENV appver 0.1.0
WORKDIR /opt/test_app
COPY --from=builder /opt/test_app/test_app-${appver}.tar.gz .
RUN apk add --no-cache bash libressl \
  && tar -xzvf test_app-${appver}.tar.gz \
  && rm -rf test_app-${appver}.tar.gz \
  && rm -rf /root/.cache \
  && rm -rf /var/cache/apk/*
CMD ["bin/test_app", "start"]
  • Using Distillery
FROM beardedeagle/alpine-phoenix-builder:1.11.3 as builder
ENV appdir /opt/test_app
WORKDIR ${appdir}
COPY . ${appdir}
RUN mix deps.get --only prod \
  && MIX_ENV=prod mix compile \
  && cd assets \
  && npm install \
  && node node_modules/webpack/bin/webpack.js --mode production \
  && cd ${appdir} \
  && MIX_ENV=prod mix phx.digest \
  && MIX_ENV=prod mix release --env=prod

FROM alpine:3.13.1
EXPOSE 4000
ENV appver 0.1.0
WORKDIR /opt/test_app
COPY --from=builder /opt/test_app/_build/prod/rel/test_app/releases/${appver}/test_app.tar.gz .
RUN apk add --no-cache bash libressl \
  && tar -xzvf test_app.tar.gz \
  && rm -rf test_app.tar.gz \
  && rm -rf /root/.cache \
  && rm -rf /var/cache/apk/*
CMD ["bin/test_app", "foreground"]

History

The code provided by PR #1 is MIT licensed by GoDaddy. Any code changes after that are MIT licensed by the repository owner.

alpine-phoenix-builder's People

Contributors

beardedeagle avatar seeekr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

alpine-phoenix-builder's Issues

Missing python in 1.11 image w/ npm 7

After bumping to your new image for elixir 1.11, the npm install step is failing w/ an error that is largely over my head:

npm notice
npm notice New minor version of npm available! 7.0.8 -> 7.3.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.3.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice
npm ERR! code 1
npm ERR! path /build/assets/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python2" can be used
npm ERR! gyp ERR! find Python - "python2" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (/build/assets/node_modules/node-gyp/lib/find-python.js:302:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/build/assets/node_modules/node-gyp/lib/find-python.js:136:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/build/assets/node_modules/node-gyp/lib/find-python.js:179:16)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/build/assets/node_modules/node-gyp/lib/find-python.js:266:16)
npm ERR! gyp ERR! stack     at exithandler (node:child_process:316:5)
npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:328:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:327:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:275:12)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:467:16)
npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:80:21)
npm ERR! gyp ERR! System Linux 4.19.121-linuxkit
npm ERR! gyp ERR! command "/usr/local/bin/node" "/build/assets/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /build/assets/node_modules/deasync
npm ERR! gyp ERR! node -v v15.1.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! Build failed

I'm sort of at a loss..

[Feature Request] July Refresh

Hello! It's been a bit of time since the last bump and we are excited for elixir:1.10.4 + erlang-23.0.2, if it's not too much trouble could we get a July refresh?

Appreciate you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.