Upgrade erlang/elixir/alpine stack (#2695)

* Dockerfile: pin elixir-1.14.3, erlang-25.2.3, alpine-3.17.0

* asdf: pin erlang 25.2.3, elixir 1.14.3-otp-25

* Remove nonsense

* Remove erlang dupe

* Remove erlang, it's in the base image already

* Remove empty file

* Truncate seconds in NaiveDateTime instances

* Bump cache key

* Mitigate Error:error:0308010C:digital envelope routines::unsupported

See: https://www.newline.co/@kchan/how-to-fix-the-error-errorerror0308010cdigital-envelope-routinesunsupported--0f8d3f17

* Upgrade to latest alpine image and pin to an exact digest

* Revert "Upgrade to latest alpine image and pin to an exact digest"

This reverts commit cdf6624efa.

* Pin alpine image to an exact digest

---------

Co-authored-by: Cenk Kücük <c@cenk.me>
This commit is contained in:
Adam Rutkowski 2023-02-22 09:49:43 +01:00 committed by GitHub
parent c307057386
commit ecb552479f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 16 deletions

View File

@ -58,8 +58,8 @@ jobs:
deps deps
_build _build
priv/plts priv/plts
key: ${{ runner.os }}-mix-v2-${{ hashFiles('**/mix.lock') }} key: ${{ runner.os }}-mix-v3-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-v2- restore-keys: ${{ runner.os }}-mix-v3-
- name: Install dependencies - name: Install dependencies
run: mix deps.get && npm install --prefix ./tracker run: mix deps.get && npm install --prefix ./tracker
- name: Check Formatting - name: Check Formatting

View File

@ -1,4 +1,4 @@
elixir 1.13.4-otp-24 erlang 25.2.3
erlang 24.3.3 elixir 1.14.3-otp-25
nodejs 16.3.0 nodejs 16.3.0
python 3.9.12 python 3.9.12

View File

@ -2,17 +2,18 @@
# platform specific, it makes sense to build it in the docker # platform specific, it makes sense to build it in the docker
#### Builder #### Builder
FROM hexpm/elixir:1.13.4-erlang-24.3.3-alpine-3.15.3 as buildcontainer FROM hexpm/elixir:1.14.3-erlang-25.2.3-alpine-3.17.0 as buildcontainer
# preparation # preparation
ENV MIX_ENV=prod ENV MIX_ENV=prod
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN mkdir /app RUN mkdir /app
WORKDIR /app WORKDIR /app
# install build dependencies # install build dependencies
RUN apk add --no-cache git nodejs yarn python3 npm ca-certificates wget gnupg make erlang gcc libc-dev && \ RUN apk add --no-cache git nodejs yarn python3 npm ca-certificates wget gnupg make gcc libc-dev && \
npm install npm@latest -g && \ npm install npm@latest -g && \
npm install -g webpack npm install -g webpack
@ -47,8 +48,8 @@ COPY rel rel
RUN mix release plausible RUN mix release plausible
# Main Docker Image # Main Docker Image
FROM alpine:3.15.3 FROM alpine:3.17.0@sha256:c0d488a800e4127c334ad20d61d7bc21b4097540327217dfab52262adc02380c
LABEL maintainer="tckb <tckb@tgrthi.me>" LABEL maintainer="plausible.io <hello@plausible.io>"
ARG BUILD_METADATA={} ARG BUILD_METADATA={}
ENV BUILD_METADATA=$BUILD_METADATA ENV BUILD_METADATA=$BUILD_METADATA

View File

@ -37,7 +37,7 @@ defmodule Plausible.Ingestion.Request do
|> Changeset.change() |> Changeset.change()
|> Changeset.put_change( |> Changeset.put_change(
:timestamp, :timestamp,
NaiveDateTime.utc_now() NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
) )
case parse_body(conn) do case parse_body(conn) do

View File

@ -1 +0,0 @@

View File

@ -191,7 +191,8 @@ defmodule PlausibleWeb.StatsControllerTest do
subdivision1_code: "EE-37", subdivision1_code: "EE-37",
city_geoname_id: 588_409, city_geoname_id: 588_409,
pathname: "/", pathname: "/",
timestamp: Timex.shift(~N[2021-10-20 12:00:00], minutes: -1), timestamp:
Timex.shift(~N[2021-10-20 12:00:00], minutes: -1) |> NaiveDateTime.truncate(:second),
referrer_source: "Google", referrer_source: "Google",
user_id: 123 user_id: 123
), ),
@ -200,7 +201,8 @@ defmodule PlausibleWeb.StatsControllerTest do
subdivision1_code: "EE-37", subdivision1_code: "EE-37",
city_geoname_id: 588_409, city_geoname_id: 588_409,
pathname: "/some-other-page", pathname: "/some-other-page",
timestamp: Timex.shift(~N[2021-10-20 12:00:00], minutes: -2), timestamp:
Timex.shift(~N[2021-10-20 12:00:00], minutes: -2) |> NaiveDateTime.truncate(:second),
referrer_source: "Google", referrer_source: "Google",
user_id: 123 user_id: 123
), ),
@ -211,23 +213,27 @@ defmodule PlausibleWeb.StatsControllerTest do
utm_source: "google", utm_source: "google",
utm_content: "content", utm_content: "content",
utm_term: "term", utm_term: "term",
timestamp: Timex.shift(~N[2021-10-20 12:00:00], days: -1), timestamp:
Timex.shift(~N[2021-10-20 12:00:00], days: -1) |> NaiveDateTime.truncate(:second),
browser: "ABrowserName" browser: "ABrowserName"
), ),
build(:pageview, build(:pageview,
timestamp: Timex.shift(~N[2021-10-20 12:00:00], months: -1), timestamp:
Timex.shift(~N[2021-10-20 12:00:00], months: -1) |> NaiveDateTime.truncate(:second),
country_code: "EE", country_code: "EE",
browser: "ABrowserName" browser: "ABrowserName"
), ),
build(:pageview, build(:pageview,
timestamp: Timex.shift(~N[2021-10-20 12:00:00], months: -5), timestamp:
Timex.shift(~N[2021-10-20 12:00:00], months: -5) |> NaiveDateTime.truncate(:second),
utm_campaign: "ads", utm_campaign: "ads",
country_code: "EE", country_code: "EE",
referrer_source: "Google", referrer_source: "Google",
browser: "ABrowserName" browser: "ABrowserName"
), ),
build(:event, build(:event,
timestamp: Timex.shift(~N[2021-10-20 12:00:00], days: -1), timestamp:
Timex.shift(~N[2021-10-20 12:00:00], days: -1) |> NaiveDateTime.truncate(:second),
name: "Signup", name: "Signup",
"meta.key": ["variant"], "meta.key": ["variant"],
"meta.value": ["A"] "meta.value": ["A"]