Skip to content

Commit

Permalink
Use Alpine Docker images as a base
Browse files Browse the repository at this point in the history
This reduces resulting image by over 100MB.
  • Loading branch information
hauleth committed Oct 12, 2018
1 parent d854d4d commit 718d838
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
16 changes: 9 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/_build
/deps
/tests
/.mc
/.elixir_ls
/data
/cover
/.DS_Store
/.elixir_ls
/.envrc
/.formatter.exs
/.mc
/_build
/cover
/data
/deps
/erl_crash.dump
/tags
/test
/tmp
27 changes: 18 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
FROM ubuntu:latest AS source
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl1.1 imagemagick ghostscript libcap2 sudo \
&& rm -rf /var/lib/apt/lists/*
FROM alpine:latest AS source
RUN apk add --update \
bash \
ghostscript \
imagemagick \
libcap \
openssl \
sudo \
&& rm -rf /var/cache/apk/*
ENV LANG C.UTF-8
ENV PORT 80
HEALTHCHECK --timeout=5s --interval=10s CMD imager ping
ENTRYPOINT ["/usr/local/bin/imager"]
CMD ["foreground"]

FROM appunite/elixir-ci:1.7.1 AS build
RUN apt-get update && apt-get install libcap-dev
FROM elixir:1.7.3-alpine AS build
RUN apk add --update \
build-base \
git \
libcap-dev \
&& rm -rf /var/cache/apk/*
ENV MIX_ENV prod
ENV OPTIMIZE true
COPY . /app
WORKDIR /app
RUN mix local.hex --force && mix local.rebar --force
RUN mix deps.get
RUN mix compile && mix release --env=prod
RUN mix do local.hex --force, local.rebar --force
RUN mix do deps.get, deps.compile
RUN mix do compile, release --env=prod

FROM source
MAINTAINER Łukasz Jan Niemier <lukasz.niemier@appunite.com>
Expand Down

0 comments on commit 718d838

Please sign in to comment.