bitwalker / alpine-elixir Goto Github PK
View Code? Open in Web Editor NEWA Dockerfile based on my alpine-erlang image for Elixir applications
License: MIT License
A Dockerfile based on my alpine-erlang image for Elixir applications
License: MIT License
When trying to use the alpine-elixir:1.10.4 image, there were a lot of new warnings and errors being raised during compilation. It looks like this was a result of the 1.10.4 docker image being upgraded to use 1.11.0 but still being tagged 1.10.4 #61.
A new version of hex was released that includes a security fix: https://hex.pm/blog/hex-v0.19-released
I guess the latest image still has an old version of hex
and rebar3
?
Here is an error message I get when trying to compile deps for docker deployment:
** (Mix) Could not compile dependency :idna, "/opt/app/.mix/rebar3 bare compile --paths "/opt/app/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix │<none> <none> 364d0d625acf 3 days ago 399 MB
deps.compile idna", update it with "mix deps.update idna" or clean it with "mix deps.clean idna" │<none> <none> b7f9335a7f8a 3 days ago 349 MB
ERROR: Service 'XXXXXX' failed to build: The command '/bin/sh -c mix do deps.get, deps.compile # --only prod' returned a non-zero code: 1
So the PR to update to 1.9.4 was merged, a version was tagged with latest but we don't have a 1.9.4 tag.
Now that we have official Elixir docker builds, also for Alpine, maybe we should direct users there instead of maintaining this docker image?
I see the repo's been updated to 1.6, but the 1.6 image hasn't been built and pushed. Any chance we could get that done?
Thanks!
function :xmerl_scan.string/1 is undefined (module :xmerl_scan is not available)
I'm just starting on the Docker & Releases journey. I get:
Step 1/7 : FROM bitwalker/alpine-elixir:1.9.1 as build
manifest for bitwalker/alpine-elixir:1.9.1 not found
with the following Dockerfile
FROM bitwalker/alpine-elixir:1.9.1 as build
COPY config ./config
COPY lib ./lib
COPY priv ./priv
COPY mix.exs .
COPY mix.lock .
RUN export MIX_ENV=prod && \
mix deps.get && \
mix release
using 1.9 instead of 1.9.1 works normally
With docker 18.09, I can build image and forward the ssh socket from host to container, so the container would not contain any ssh credential.
Run docker build with --ssh
flag
> eval $(ssh-agent -s)
> ssh-add ~/.ssh/id_rsa
> DOCKER_BUILDKIT=1 docker build --progress=plain --ssh default .
with this Dockerfile, and the agent forwarding doesn't work
# syntax=docker/dockerfile:experimental
FROM bitwalker/alpine-elixir:1.8.1
RUN echo "......... start building image ............"
RUN apk add --no-cache openssh-client git
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh git clone [email protected]:organization/project.git
The ssh agent forwarding doesn't work and throws an error Host key verification failed.
.
However, it works properly with latest alpine.
# syntax=docker/dockerfile:experimental
FROM alpine:3.9
RUN echo "......... start building image ............"
RUN apk add --no-cache openssh-client git
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh git clone [email protected]:organization/project.git
The base image of alpine-elixir is alpine-erlang, and latest alpine-erlang uses alpine:3.9 as it's base. Thanks for your consideration.
The following DockerFile is no longer building on several machines.
It fails on theRUN
command following the # Install NPM
comment with the error
#13 18.22 ERROR: http://dl-cdn.alpinelinux.org/alpine/edge/main: UNTRUSTED signature
Bumping docker image version to 1.13.4 fixes the problem.
From my sparse understanding of Alpine and Docker, it appears that some dependencies have likely been shuffled between repos, but I don't know enough to fix this problem without spending more time than I have.
Is there a simple fix, or do you recommend going with 1.13.x
FROM bitwalker/alpine-elixir:1.12.2 AS phx-builder
RUN mix local.hex --force && mix local.rebar --force
# Important! Update this no-op ENV variable when this Dockerfile
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT=2019-07-31
# Install NPM
RUN \
mkdir -p /opt/app && \
chmod -R 777 /opt/app && \
apk update && \
apk --no-cache --update add \
make \
g++ \
wget \
curl \
inotify-tools \
nodejs \
npm && \
npm install npm -g --no-progress && \
update-ca-certificates --fresh && \
rm -rf /var/cache/apk/*
# Add local node module binaries to PATH
ENV PATH=./node_modules/.bin:$PATH
# Ensure latest versions of Hex/Rebar are installed on build
ONBUILD RUN mix do local.hex --force, local.rebar --force
WORKDIR /opt/app
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 mix do compile, assets.deploy && \
mix release --force
FROM alpine:3.13.5
EXPOSE 4000
ENV PORT=4000 MIX_ENV=prod
ENV LANG=en_US.UTF-8 \
HOME=/opt/app/ \
# Set this so that CTRL+G works properly
TERM=xterm \
PATH=/opt/app/bin:/usr/local/bin:${PATH}
RUN apk add --no-cache libstdc++
RUN \
# Create default user and home directory, set owner to default
adduser -s /bin/sh -u 1001 -G root -h "${HOME}" -S -D default && \
chown -R 1001:0 "${HOME}" && \
# Add tagged repos as well as the edge repo so that we can selectively install edge packages
echo "@main http://dl-cdn.alpinelinux.org/alpine/v3.10/main" >> /etc/apk/repositories && \
echo "@community http://dl-cdn.alpinelinux.org/alpine/v3.10/community" >> /etc/apk/repositories && \
echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
# Upgrade Alpine and base packages
apk --no-cache --update --available upgrade && \
# Install bash and Erlang/OTP deps
apk add --no-cache --update pcre@edge && \
apk add --no-cache --update \
imagemagick \
bash \
ca-certificates \
openssl \
ncurses \
unixodbc \
zlib && \
# Update ca certificates
update-ca-certificates --fresh
COPY --from=phx-builder /opt/app/_build/prod/rel/pay .
COPY --from=phx-builder /opt/app/priv/fonts/* /usr/share/fonts/
CMD cd /opt/app && pay eval "Pay.Release.migrate()" && pay start
Hi,
I'm just looking at the image sizes for the empty containers:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
bitwalker/alpine-elixir latest d814edb83fe0 4 days ago 144MB
bitwalker/alpine-erlang latest e5c5ce95529b 7 days ago 120MB
This is Java-size :)
Many people were reporting significantly smaller sizes so I'm trying to understand if this is normal?
It looks like a new docker image was built a few days ago for the 1.7.4 version bump, but only the "latest" tag shows as updated on docker hub: https://hub.docker.com/r/bitwalker/alpine-elixir/tags/
Attempting to use the tag in a Dockerfile results in an error:
$ docker build .
Sending build context to Docker daemon 2.353MB
Step 1/2 : FROM bitwalker/alpine-elixir:1.7.4
manifest for bitwalker/alpine-elixir:1.7.4 not found
... based on Erlang 24, that takes advantage of Erlang's JIT.
Any plans on making latest to be 1.11.3 ?
also please create 1.11.3 as tag since we sometimes need to fix versions instead of using :latest
libcurl 7.55.0 is out, 7.54.x is used.
Similar to #28:
Could you create a tag for 1.8.1
on docker hub in order to us having a dedicated tag to use instead of latest
?
Thanks!
We were using 1.9.1, but the upgrade to OTP 22.1 broke hackney, resulting in an outage on our servers. Would it be possible to have stable version tags? So a build to a specific point version would not have breaking changes?
Hi. Using alpine-elixir:1.4.5
and when I try to run apk add build-base
, I get the following error:
# apk add build-base
ERROR: unsatisfiable constraints:
musl-1.1.16-r10:
breaks: musl-dev-1.1.16-r13[musl=1.1.16-r13]
satisfies: musl-utils-1.1.16-r10[musl=1.1.16-r10] musl-utils-1.1.16-r10[so:libc.musl-x86_64.so.1] pkgconf-1.3.7-r0[so:libc.musl-x86_64.so.1] gcc-6.3.0-r4[so:libc.musl-x86_64.so.1] binutils-libs-2.28-r2[so:libc.musl-x86_64.so.1]
libcrypto1.0-1.0.2k-r0[so:libc.musl-x86_64.so.1] g++-6.3.0-r4[so:libc.musl-x86_64.so.1] libressl2.5-libcrypto-2.5.4-r0[so:libc.musl-x86_64.so.1] readline-6.3.008-r5[so:libc.musl-x86_64.so.1]
libressl2.5-libssl-2.5.4-r0[so:libc.musl-x86_64.so.1] mpfr3-3.1.5-r0[so:libc.musl-x86_64.so.1] ncurses-libs-6.0-r7[so:libc.musl-x86_64.so.1] libstdc++-6.3.0-r4[so:libc.musl-x86_64.so.1]
isl-0.17.1-r0[so:libc.musl-x86_64.so.1] libcurl-7.54.0-r0[so:libc.musl-x86_64.so.1] mpc1-1.0.3-r0[so:libc.musl-x86_64.so.1] git-2.13.0-r0[so:libc.musl-x86_64.so.1] pcre-8.40-r2[so:libc.musl-x86_64.so.1]
unixodbc-2.3.4-r0[so:libc.musl-x86_64.so.1] zlib-1.2.11-r0[so:libc.musl-x86_64.so.1] libgomp-6.3.0-r4[so:libc.musl-x86_64.so.1] apk-tools-2.7.2-r0[so:libc.musl-x86_64.so.1] libssh2-1.8.0-r1[so:libc.musl-x86_64.so.1]
libgcc-6.3.0-r4[so:libc.musl-x86_64.so.1] make-4.2.1-r0[so:libc.musl-x86_64.so.1] alpine-baselayout-3.0.4-r0[so:libc.musl-x86_64.so.1] libatomic-6.3.0-r4[so:libc.musl-x86_64.so.1]
ca-certificates-20161130-r2[so:libc.musl-x86_64.so.1] gmp-6.1.2-r0[so:libc.musl-x86_64.so.1] busybox-1.26.2-r5[so:libc.musl-x86_64.so.1] scanelf-1.2.2-r0[so:libc.musl-x86_64.so.1] expat-2.2.0-r1[so:libc.musl-x86_64.so.1]
binutils-2.28-r2[so:libc.musl-x86_64.so.1] libssl1.0-1.0.2k-r0[so:libc.musl-x86_64.so.1]
Upgrade musl first fixes the problem. Not sure why.
My releases won't run without libstdc++.
Error loading shared library libstdc++.so.6: No such file or directory (needed by /opt/app/my_app/erts-12.2.1/bin/beam.smp)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /opt/app/my_app/erts-12.2.1/bin/beam.smp)
This temporary solution works.
FROM bitwalker/alpine-erlang:latest
RUN apk add --allow-untrusted --no-cache libstdc++
Probably libstdc++ should be part of bitwalker/alpine-erlang ?
My ci was working fine but Thursday morning this error starting showing up, I have not made any changes to cause this.
$ apk add build-base
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
musl-1.1.19-r10:
breaks: musl-dev-1.1.19-r11[musl=1.1.19-r11]
satisfies:
musl-utils-1.1.19-r10[musl=1.1.19-r10]
musl-utils-1.1.19-r10[so:libc.musl-x86_64.so.1]
pkgconf-1.5.1-r0[so:libc.musl-x86_64.so.1]
gcc-6.4.0-r9[so:libc.musl-x86_64.so.1]
libcrypto1.0-1.0.2o-r2[so:libc.musl-x86_64.so.1]
g++-6.4.0-r9[so:libc.musl-x86_64.so.1]
readline-7.0.003-r0[so:libc.musl-x86_64.so.1]
bash-4.4.19-r1[so:libc.musl-x86_64.so.1]
ca-certificates-20171114-r3[so:libc.musl-x86_64.so.1]
busybox-1.28.4-r1[so:libc.musl-x86_64.so.1]
binutils-2.30-r5[so:libc.musl-x86_64.so.1]
mpfr3-3.1.5-r1[so:libc.musl-x86_64.so.1]
ncurses-libs-6.1-r0[so:libc.musl-x86_64.so.1]
expat-2.2.5-r0[so:libc.musl-x86_64.so.1]
git-2.18.0-r0[so:libc.musl-x86_64.so.1]
nghttp2-libs-1.32.0-r0[so:libc.musl-x86_64.so.1]
libstdc++-6.4.0-r9[so:libc.musl-x86_64.so.1]
file-5.32-r1[so:libc.musl-x86_64.so.1]
isl-0.18-r0[so:libc.musl-x86_64.so.1]
libcurl-7.61.0-r0[so:libc.musl-x86_64.so.1]
mpc1-1.0.3-r1[so:libc.musl-x86_64.so.1]
libmagic-5.32-r1[so:libc.musl-x86_64.so.1]
pcre-8.42-r0[so:libc.musl-x86_64.so.1]
unixodbc-2.3.5-r0[so:libc.musl-x86_64.so.1]
zlib-1.2.11-r1[so:libc.musl-x86_64.so.1]
libgomp-6.4.0-r9[so:libc.musl-x86_64.so.1]
apk-tools-2.10.0-r0[so:libc.musl-x86_64.so.1]
libssh2-1.8.0-r3[so:libc.musl-x86_64.so.1]
make-4.2.1-r2[so:libc.musl-x86_64.so.1]
libressl2.7-libcrypto-2.7.4-r0[so:libc.musl-x86_64.so.1]
libgcc-6.4.0-r9[so:libc.musl-x86_64.so.1]
alpine-baselayout-3.1.0-r0[so:libc.musl-x86_64.so.1]
libatomic-6.4.0-r9[so:libc.musl-x86_64.so.1]
pcre2-10.31-r0[so:libc.musl-x86_64.so.1]
scanelf-1.2.3-r0[so:libc.musl-x86_64.so.1]
gmp-6.1.2-r1[so:libc.musl-x86_64.so.1]
libressl2.7-libssl-2.7.4-r0[so:libc.musl-x86_64.so.1]
libssl1.0-1.0.2o-r2[so:libc.musl-x86_64.so.1]
I have been wrestling with this for a few days and really need to solve this so i can push some code up, any help would be great!
Currently only 1.11.0 is published on dockerhub.
It would also be nice to add git tags for the releases. I can work on adding a Github action to automate this if you would like.
Hello,
first thanks for your really good work. But how can I add some dependencies to your alpine docker image. Right know we need to add apk add erlang-xmerl
but when I use it install also erlang 19 but we want to use 20. Is it possible to install so our pheonix app will see xmerl?
You may want to change:
bitwalker/alpine-erlang:latest
to
bitwalker/alpine-erlang:19.3.4
for this version?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.