mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 17:44:43 +03:00
32456d4348
* Bump asdf erlang & elixir * Bump erlang/elixir in the dockerfile * Remove Oban.Stager config as per https://github.com/sorentwo/oban/blob/main/guides/upgrading/v2.14.md * Configure Oban for tests as per https://github.com/sorentwo/oban/blob/main/guides/upgrading/v2.14.md * Mark sampling hint clause with unsafe fragment Any other/recommended way to do that? cc @ruslandoga * Address String.slice/2 deprecation * Update deps * Address 0.0 matching warning * Make funnel settings work although this is probably not the best way to do it. Needs revisiting, not sure what broke it - could not find any breaking changes in related dependencies. * Migrate oban as per https://github.com/sorentwo/oban/blob/main/guides/upgrading/v2.17.md * Update credo * Bump CI cache * Use `Bypass.pass` to avoid exit shutdown message
84 lines
2.1 KiB
Docker
84 lines
2.1 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.16.0-erlang-26.2.1-alpine-3.18.4 as buildcontainer
|
|
|
|
ARG MIX_ENV=small
|
|
|
|
# preparation
|
|
ENV MIX_ENV=$MIX_ENV
|
|
ENV NODE_ENV=production
|
|
ENV NODE_OPTIONS=--openssl-legacy-provider
|
|
|
|
# custom ERL_FLAGS are passed for (public) multi-platform builds
|
|
# to fix qemu segfault, more info: https://github.com/erlang/otp/pull/6340
|
|
ARG ERL_FLAGS
|
|
ENV ERL_FLAGS=$ERL_FLAGS
|
|
|
|
RUN mkdir /app
|
|
WORKDIR /app
|
|
|
|
# install build dependencies
|
|
RUN apk add --no-cache git nodejs yarn python3 npm ca-certificates wget gnupg make gcc libc-dev && \
|
|
npm install npm@latest -g
|
|
|
|
COPY mix.exs ./
|
|
COPY mix.lock ./
|
|
COPY config ./config
|
|
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 install --prefix ./assets && \
|
|
npm install --prefix ./tracker
|
|
|
|
COPY assets ./assets
|
|
COPY tracker ./tracker
|
|
COPY priv ./priv
|
|
COPY lib ./lib
|
|
COPY extra ./extra
|
|
|
|
RUN npm run deploy --prefix ./tracker && \
|
|
mix assets.deploy && \
|
|
mix phx.digest priv/static && \
|
|
mix download_country_database && \
|
|
# https://hexdocs.pm/sentry/Sentry.Sources.html#module-source-code-storage
|
|
mix sentry_recompile
|
|
|
|
WORKDIR /app
|
|
COPY rel rel
|
|
RUN mix release plausible
|
|
|
|
# Main Docker Image
|
|
FROM alpine:3.18.4
|
|
LABEL maintainer="plausible.io <hello@plausible.io>"
|
|
|
|
ARG BUILD_METADATA={}
|
|
ENV BUILD_METADATA=$BUILD_METADATA
|
|
ENV LANG=C.UTF-8
|
|
ARG MIX_ENV=small
|
|
ENV MIX_ENV=$MIX_ENV
|
|
|
|
RUN apk upgrade --no-cache
|
|
|
|
RUN apk add --no-cache openssl ncurses libstdc++ libgcc ca-certificates
|
|
|
|
COPY ./rel/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/${MIX_ENV}/rel/plausible /app
|
|
RUN chown -R plausibleuser:plausibleuser /app
|
|
USER plausibleuser
|
|
WORKDIR /app
|
|
ENV LISTEN_IP=0.0.0.0
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
EXPOSE 8000
|
|
CMD ["run"]
|