From 509f940ae09d2da6ac86bcab7635eec9defdb62e Mon Sep 17 00:00:00 2001 From: Geng Tan Date: Thu, 31 Mar 2022 18:02:01 -0400 Subject: [PATCH 1/2] adding dockerfile and gha pipeline --- .github/workflows/turkeyportal.yml | 15 +++++++++++++ Dockerfile | 34 ++++++++++++++++++++++++++++++ mix.exs | 3 ++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/turkeyportal.yml create mode 100644 Dockerfile diff --git a/.github/workflows/turkeyportal.yml b/.github/workflows/turkeyportal.yml new file mode 100644 index 00000000..10221290 --- /dev/null +++ b/.github/workflows/turkeyportal.yml @@ -0,0 +1,15 @@ +name: turkeyportal +on: + push: + branches: + paths-ignore: ["README.md"] + workflow_dispatch: + +jobs: + turkeyGitops: + uses: mozilla/hubs-ops/.github/workflows/turkeyGitops.yml@master + with: + registry: mozillareality + dockerfile: Dockerfile + secrets: + DOCKER_HUB_PWD: ${{ secrets.DOCKER_HUB_PWD }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..299502a8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# ---- build stage ---- +FROM elixir:1.13 as builder +RUN apt-get update -y && apt-get install -y build-essential git \ + && apt-get clean && rm -f /var/lib/apt/lists/*_* +RUN mix local.rebar --force \ + && mix local.hex --force +ENV MIX_ENV=prod +COPY mix.exs mix.lock ./ +RUN mix deps.get --only $MIX_ENV +RUN mkdir config +COPY config/config.exs config/${MIX_ENV}.exs config/ +RUN mix deps.compile +COPY priv priv +COPY assets assets +# RUN mix assets.deploy +COPY lib ./lib +RUN mix compile +COPY config/runtime.exs config/ +# COPY rel rel +RUN mix release + +# ---- app stage ---- +from debian:bullseye-slim +RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales \ + && apt-get clean && rm -f /var/lib/apt/lists/*_* +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 +WORKDIR "/app" +RUN chown nobody /app +COPY --from=builder --chown=nobody:root /_build/prod/rel/prtl ./ +USER nobody +CMD /app/bin/prtl start diff --git a/mix.exs b/mix.exs index 370330ea..7af29d93 100644 --- a/mix.exs +++ b/mix.exs @@ -48,7 +48,8 @@ defmodule Prtl.MixProject do {:telemetry_poller, "~> 1.0"}, {:gettext, "~> 0.18"}, {:jason, "~> 1.2"}, - {:plug_cowboy, "~> 2.5"} + {:plug_cowboy, "~> 2.5"}, + {:poison, "~> 5.0"} ] end From 7d18c446474873d4bb5653ad520140a2da379d56 Mon Sep 17 00:00:00 2001 From: Geng Tan Date: Fri, 1 Apr 2022 09:16:26 -0400 Subject: [PATCH 2/2] adding dockerfile and gha pipeline --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 299502a8..50ecd99e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ RUN mix deps.compile COPY priv priv COPY assets assets # RUN mix assets.deploy +RUN mix phx.digest COPY lib ./lib RUN mix compile COPY config/runtime.exs config/