analytics/Dockerfile
Oliver Kriska 4d4f8ba5c3
Elixir & Docker upgrade (#566)
* Elixir upgrade

 - upgraded Elixir to 1.11.2
 - upgraded Erlang to 23.2.1
 - upgraded Phoenix to 1.5.7
 - Upgraded:
  bamboo_postmark 0.6.0 => 0.7.0 (minor)
  bcrypt_elixir 2.2.0 => 2.3.0
  csv 2.3.1 => 2.4.1
  ecto 3.4.6 => 3.5.5
  ecto_sql 3.4.4 => 3.5.3
  elixir_make 0.6.0 => 0.6.2
  ex_machina 2.4.0 => 2.5.0
  excoveralls 0.12.3 => 0.13.4 (minor)
  file_system 0.2.8 => 0.2.10
  gettext 0.18.0 => 0.18.2
  httpoison 1.6.2 => 1.7.0
  nanoid 2.0.2 => 2.0.5
  phoenix_ecto 4.1.0 => 4.2.1
  phoenix_live_reload 1.2.2 => 1.3.0
  postgrex 0.15.5 => 0.15.7
  sentry 7.2.4 => 7.2.5
  timex 3.6.2 => 3.6.3
  tzdata 1.0.3 => 1.0.5
  yamerl 0.8.0 => 0.8.1

* Elixir & Docker upgrade

upgraded to 1.11.3

* Docker

 - fixed missing python3 package for newer Alpine linux
2021-01-13 10:31:16 +02:00

69 lines
1.7 KiB
Docker

# we can not use the pre-built tar because the distribution is
# platform specific, it makes sense to build it in the docker
#### Builder
FROM hexpm/elixir:1.11.3-erlang-23.2.1-alpine-3.12.1 as buildcontainer
# preparation
ARG APP_VER=0.0.1
ENV MIX_ENV=prod
ENV NODE_ENV=production
ENV APP_VERSION=$APP_VER
RUN mkdir /app
WORKDIR /app
# install build dependencies
RUN apk add --no-cache git nodejs yarn python3 npm ca-certificates wget gnupg make erlang gcc libc-dev && \
npm install npm@latest -g && \
npm install -g webpack
COPY mix.exs ./
COPY mix.lock ./
RUN mix local.hex --force && \
mix local.rebar --force && \
mix deps.get --only prod && \
mix deps.compile
COPY assets/package.json assets/package-lock.json ./assets/
COPY tracker/package.json tracker/package-lock.json ./tracker/
RUN npm audit fix --prefix ./assets && \
npm install --prefix ./assets && \
npm install --prefix ./tracker
COPY assets ./assets
COPY tracker ./tracker
COPY config ./config
COPY priv ./priv
COPY lib ./lib
RUN npm run deploy --prefix ./assets && \
npm run deploy --prefix ./tracker && \
mix phx.digest priv/static
WORKDIR /app
COPY rel rel
RUN mix release plausible
# Main Docker Image
FROM alpine:3.12.1
LABEL maintainer="tckb <tckb@tgrthi.me>"
ENV LANG=C.UTF-8
RUN apk update && apk upgrade
RUN apk add --no-cache openssl ncurses
COPY .gitlab/build-scripts/docker-entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh && \
adduser -h /app -u 1000 -s /bin/sh -D plausibleuser
COPY --from=buildcontainer /app/_build/prod/rel/plausible /app
RUN chown -R plausibleuser:plausibleuser /app
USER plausibleuser
WORKDIR /app
ENTRYPOINT ["/entrypoint.sh"]
CMD ["run"]