furqankassa/DockerImageRecognitionToText
0
1# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian instead of2# Alpine to avoid DNS resolution issues in production.3#4# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu5# https://hub.docker.com/_/ubuntu?tab=tags6#7#8# This file is based on these images:9#10# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image11# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20210902-slim - for the release image12# - https://pkgs.org/ - resource for finding needed packages13# - Ex: hexpm/elixir:1.13.4-erlang-24.0.1-debian-bullseye-20210902-slim14#15ARG ELIXIR_VERSION=1.14.216ARG OTP_VERSION=25.117ARG DEBIAN_VERSION=bullseye-20220801-slim18 19ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"20ARG RUNNER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"21 22FROM ${BUILDER_IMAGE} as builder23 24# install build dependencies25RUN apt-get update -y && apt-get install -y build-essential git curl \26 && apt-get clean && rm -f /var/lib/apt/lists/*_*27 28# prepare build dir29WORKDIR /app30 31# set build ENV32ENV MIX_ENV="prod"33ENV MIX_HOME="/app/.mix"34ENV EXS_DRY_RUN="true"35ENV MIX_INSTALL_DIR="/app/.mix"36ENV BUMBLEBEE_CACHE_DIR="/app/.bumblebee"37 38# install hex + rebar39RUN mix local.hex --force && \40 mix local.rebar --force41 42# install mix dependencies43COPY run.exs ./44RUN elixir ./run.exs45 46# start a new build stage so that the final image will only contain47# the compiled release and other runtime necessities48FROM ${RUNNER_IMAGE}49 50# install build dependencies51RUN apt-get update -y && apt-get install -y build-essential git curl \52 && apt-get clean && rm -f /var/lib/apt/lists/*_*53 54WORKDIR "/app"55 56# set runner ENV57ENV MIX_ENV="prod"58ENV MIX_HOME="/app/.mix"59ENV MIX_INSTALL_DIR="/app/.mix"60ENV BUMBLEBEE_CACHE_DIR="/app/.bumblebee"61ENV SHELL=/bin/bash62ENV PORT=786063 64EXPOSE 786065 66# Only copy the final release from the build stage67COPY --from=builder --chown=nobody:root /app/.mix/ ./.mix68COPY --from=builder --chown=nobody:root /app/.bumblebee/ ./.bumblebee69COPY --from=builder --chown=nobody:root /app/run.exs ./70 71CMD ["elixir", "/app/run.exs"]