## 2024-12-26 -- file created using `mix phx.gen.release --docker`





# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
# instead of Alpine to avoid DNS resolution issues in production.
#
# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu
# https://hub.docker.com/_/ubuntu?tab=tags
#
# This file is based on these images:
#
#   - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
#   - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20241202-slim - for the release image
#   - https://pkgs.org/ - resource for finding needed packages
#   - Ex: hexpm/elixir:1.17.3-erlang-27.1.2-debian-bullseye-20241202-slim
#   - https://gitlab.com/ericlathrop/dockerize_elixir/-/blob/main/priv/templates/Dockerfile?ref_type=heads





FROM elixir:1.17.2-alpine AS dev

RUN apk add --no-cache git gcc make inotify-tools \
    && mkdir /home/user \
    && chown 1000.1000 /home/user

ENV HOME=/home/user
USER 1000:1000

# prepare build dir
WORKDIR /app

# install hex + rebar
RUN mix local.hex --force && \
    mix local.rebar --force

# set build ENV
ENV MIX_ENV="dev"
ENV DATABASE_URL=""
ENV PORT=""

# install mix dependencies
COPY ./services/bright/mix.exs ./services/bright/mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config

# copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY ./services/bright/config/config.exs ./services/bright/config/${MIX_ENV}.exs config/

COPY ./services/bright/priv priv

COPY ./services/bright/lib lib

COPY ./services/bright/assets assets

CMD [ "mix", "ecto.setup", "&&", "mix", "phx.server" ]