Update dockerfile for build options (#3567)

* Update dockerfile for build options

* Start permanent on small

* Default to small

* Default to small fixup
This commit is contained in:
hq1 2023-11-30 12:39:34 +01:00 committed by GitHub
parent 8dfaad56f0
commit bd7deb5631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View File

@ -47,6 +47,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
MIX_ENV=prod
BUILD_METADATA=${{ steps.meta.outputs.json }}
- name: Image digest

View File

@ -46,6 +46,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
MIX_ENV=small
BUILD_METADATA=${{ steps.meta.outputs.json }}
ERL_FLAGS=+JPperf true

View File

@ -4,8 +4,10 @@
#### Builder
FROM hexpm/elixir:1.15.7-erlang-26.1.2-alpine-3.18.4 as buildcontainer
ARG MIX_ENV=small
# preparation
ENV MIX_ENV=prod
ENV MIX_ENV=$MIX_ENV
ENV NODE_ENV=production
ENV NODE_OPTIONS=--openssl-legacy-provider
@ -59,6 +61,8 @@ 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
@ -69,7 +73,7 @@ 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/prod/rel/plausible /app
COPY --from=buildcontainer /app/_build/${MIX_ENV}/rel/plausible /app
RUN chown -R plausibleuser:plausibleuser /app
USER plausibleuser
WORKDIR /app

View File

@ -10,7 +10,7 @@ defmodule Plausible.MixProject do
version: System.get_env("APP_VERSION", "0.0.1"),
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
start_permanent: Mix.env() in [:prod, :small],
aliases: aliases(),
deps: deps(),
test_coverage: [