diff --git a/Dockerfile b/Dockerfile index 53e1408c..d73cc113 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,23 @@ -FROM elixir:1.11.4 AS builder +FROM erlang:24 AS builder + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +ENV ELIXIR_VERSION="v1.12.0-rc.1" \ + LANG=C.UTF-8 + +RUN set -xe \ + && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ + && ELIXIR_DOWNLOAD_SHA256="f04142fb0a6c3f27a342109308085aaa75b95dbf4782d9c7be12446150b2b4be" \ + && curl -fSL -o elixir-src.tar.gz $ELIXIR_DOWNLOAD_URL \ + && echo "$ELIXIR_DOWNLOAD_SHA256 elixir-src.tar.gz" | sha256sum -c - \ + && mkdir -p /usr/local/src/elixir \ + && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ + && rm elixir-src.tar.gz \ + && cd /usr/local/src/elixir \ + && make install clean + +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl ca-certificates git RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ apt-get update && apt-get install -y --no-install-recommends nodejs @@ -41,21 +60,22 @@ ENV LANG=C.UTF-8 \ SRTM_CACHE=/opt/app/.srtm_cache \ HOME=/opt/app -RUN apt-get update && apt-get install -y --no-install-recommends \ - libodbc1 \ - libsctp1 \ - libssl1.1 \ - netcat \ - tini \ - tzdata - -RUN addgroup --gid 10001 --system nonroot && \ - adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot - WORKDIR $HOME -RUN chown -R nonroot:nonroot . -USER nonroot:nonroot +RUN apt-get update && apt-get install -y --no-install-recommends \ + libodbc1 \ + libsctp1 \ + libssl1.1 \ + libstdc++6 \ + netcat \ + tini \ + tzdata && \ + rm -rf /var/lib/apt/lists/* && \ + addgroup --gid 10001 --system nonroot && \ + adduser --uid 10000 --system --ingroup nonroot --home /home/nonroot nonroot && \ + chown -R nonroot:nonroot . + +USER nonroot:nonroot COPY --chown=nonroot:nonroot entrypoint.sh / COPY --from=builder --chown=nonroot:nonroot /opt/built . RUN mkdir $SRTM_CACHE diff --git a/mix.exs b/mix.exs index 6de7ee8e..2dba50a8 100644 --- a/mix.exs +++ b/mix.exs @@ -60,7 +60,9 @@ defmodule TeslaMate.MixProject do {:websockex, "~> 0.4"}, {:tzdata, "~> 1.1"}, {:finch, "~> 0.3"}, - {:tesla, "~> 1.3"} + {:tesla, "~> 1.4"}, + # TODO: Remove this once v1.2.2 is out + {:mint, "~> 1.2", github: "elixir-mint/mint", override: true} ] end diff --git a/mix.lock b/mix.lock index 67ebc241..cd52082a 100644 --- a/mix.lock +++ b/mix.lock @@ -27,7 +27,7 @@ "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, - "mint": {:hex, :mint, "1.2.1", "369cc8fecc54afd170e11740aa7efd066709e5ef3b5a2c63f0a47d1542cbd56a", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "053fe2f48c965f31878a16272478d9299fa412bc4df86dee2678986f2e40e018"}, + "mint": {:git, "https://github.com/elixir-mint/mint.git", "dc655a2ebdf4c7a8556da4a0fb082b9549b54f2a", []}, "mock": {:hex, :mock, "0.3.6", "e810a91fabc7adf63ab5fdbec5d9d3b492413b8cda5131a2a8aa34b4185eb9b4", [:mix], [{:meck, "~> 0.8.13", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "bcf1d0a6826fb5aee01bae3d74474669a3fa8b2df274d094af54a25266a1ebd2"}, "nimble_csv": {:hex, :nimble_csv, "1.1.0", "b1dba4a86be9e03065c9de829050468e591f569100332db949e7ce71be0afc25", [:mix], [], "hexpm", "e986755bc302832cac429be6deda0fc9d82d3c82b47abefb68b3c17c9d949a3f"}, "nimble_options": {:hex, :nimble_options, "0.3.5", "a4f6820cdcb4ee444afd78635f323e58e8a5ddf2fbbe9b9d283a99f972034bae", [:mix], [], "hexpm", "f5507cc90033a8d12769522009c80aa9164af6bab245dbd4ad421d008455f1e1"},