Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Move ARG to running container instead of build container
Uku Tahtb667d65d52f0
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymlindex b60996bb97..95c4a3f957 100644--- a/.github/workflows/docker.yml+++ b/.github/workflows/docker.yml@@ -42,6 +42,8 @@ jobs:labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max- build-arg: BUILD_METADATA=${{ steps.meta.outputs.json }}+ build-args: |+ BUILD_METADATA=${{ steps.meta.outputs.json }}+- name: Image digestrun: echo ${{ steps.docker_build.outputs.digest }}diff --git a/Dockerfile b/Dockerfileindex d64f8d5038..822cf4345d 100644--- a/Dockerfile+++ b/Dockerfile@@ -5,33 +5,31 @@FROM hexpm/elixir:1.13.4-erlang-24.3.3-alpine-3.15.3 as buildcontainer# preparation-ARG APP_VER=0.0.1ENV MIX_ENV=prodENV NODE_ENV=production-ENV APP_VERSION=$APP_VERRUN mkdir /appWORKDIR /app# install build dependenciesRUN 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+ npm install npm@latest -g && \+ npm install -g webpackRUN wget https://s3.eu-central-1.wasabisys.com/plausible-application/geonames.csv -qCOPY mix.exs ./COPY mix.lock ./RUN mix local.hex --force && \- mix local.rebar --force && \- mix deps.get --only prod && \- mix deps.compile+ mix local.rebar --force && \+ mix deps.get --only prod && \+ mix deps.compileCOPY 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+ npm install --prefix ./trackerCOPY assets ./assetsCOPY tracker ./tracker@@ -40,12 +38,12 @@ COPY priv ./privCOPY lib ./libRUN npm run deploy --prefix ./assets && \- npm run deploy --prefix ./tracker && \- mix phx.digest priv/static && \- mix download_country_database && \-# https://hexdocs.pm/sentry/Sentry.Sources.html#module-source-code-storage- mix sentry_recompile && \- mv geonames.csv ./priv/geonames.csv+ npm run deploy --prefix ./tracker && \+ mix phx.digest priv/static && \+ mix download_country_database && \+ # https://hexdocs.pm/sentry/Sentry.Sources.html#module-source-code-storage+ mix sentry_recompile && \+ mv geonames.csv ./priv/geonames.csvWORKDIR /appCOPY rel rel@@ -54,6 +52,9 @@ RUN mix release plausible# Main Docker ImageFROM alpine:3.15.3LABEL maintainer="tckb <[email protected]>"++ARG BUILD_METADATA={}+ENV BUILD_METADATA=$BUILD_METADATAENV LANG=C.UTF-8RUN apk upgrade --no-cache@@ -63,7 +64,7 @@ RUN apk add --no-cache openssl ncurses libstdc++ libgccCOPY .gitlab/build-scripts/docker-entrypoint.sh /entrypoint.shRUN chmod a+x /entrypoint.sh && \- adduser -h /app -u 1000 -s /bin/sh -D plausibleuser+ adduser -h /app -u 1000 -s /bin/sh -D plausibleuserCOPY --from=buildcontainer /app/_build/prod/rel/plausible /appRUN chown -R plausibleuser:plausibleuser /appdiff --git a/config/.env.dev b/config/.env.devindex d1d896e203..7f09444eeb 100644--- a/config/.env.dev+++ b/config/.env.dev@@ -1,6 +1,6 @@BASE_URL=http://localhost:8000-DATABASE_URL=postgres://postgres:[email protected]:5432/plausible_dev-CLICKHOUSE_DATABASE_URL=http://127.0.0.1:8123/plausible_events_db+DATABASE_URL=postgres://postgres:[email protected]:5432/plausible_dev+CLICKHOUSE_DATABASE_URL=http://host.docker.internal:8123/plausible_events_dbSECRET_KEY_BASE=/njrhntbycvastyvtk1zycwfm981vpo/0xrvwjjvemdakc/vsvbrevlwsc6u8rcgENVIRONMENT=devMAILER_ADAPTER=Bamboo.LocalAdapterdiff --git a/lib/plausible_web/controllers/api/external_controller.ex b/lib/plausible_web/controllers/api/external_controller.exindex f1c9bf2a1b..1303f566c1 100644--- a/lib/plausible_web/controllers/api/external_controller.ex+++ b/lib/plausible_web/controllers/api/external_controller.ex@@ -66,7 +66,7 @@ defmodule PlausibleWeb.Api.ExternalController do_ -> %{}end- build_info = System.get_env("BUILD_METADATA", "{}") |> Jason.decode!()+ build_metadata = System.get_env("BUILD_METADATA", "{}") |> Jason.decode!()geo_database =case Geolix.metadata([:geolocation]) do@@ -80,7 +80,7 @@ defmodule PlausibleWeb.Api.ExternalController doinfo =Map.merge(version, %{geo_database: geo_database,- build: build_info+ build: build_metadata})json(conn, info)