Skip to content

Commit

Permalink
Alpine => Debian
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmj committed Jan 12, 2025
1 parent d5ce439 commit 422b2ff
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
44 changes: 39 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
FROM hexpm/elixir:1.14.0-erlang-25.1-alpine-3.16.2 as build
ARG ELIXIR_VERSION=1.18.1
ARG ERLANG_VERSION=27.2
ARG DEBIAN_VERSION=bookworm-20241223-slim

FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-debian-${DEBIAN_VERSION} AS build

ENV LANG=C.UTF-8

# install build dependencies
RUN apk add --no-cache git
RUN apt update -y && \
apt upgrade -y && \
apt install -y --no-install-recommends git build-essential ca-certificates gnupg lsb-release wget && \
apt clean -y && rm -rf /var/lib/apt/lists/*

RUN wget https://pkg.tarsnap.com/tarsnap-deb-packaging-key.asc && \
gpg --dearmor tarsnap-deb-packaging-key.asc && \
mv tarsnap-deb-packaging-key.asc.gpg tarsnap-archive-keyring.gpg && \
cp tarsnap-archive-keyring.gpg /usr/share/keyrings/ && \
echo "deb [signed-by=/usr/share/keyrings/tarsnap-archive-keyring.gpg] http://pkg.tarsnap.com/deb/$(lsb_release -s -c) ./" | tee -a /etc/apt/sources.list.d/tarsnap.list

RUN apt update -y && \
apt install --no-install-recommends -y tarsnap-archive-keyring && \
echo "deb-src [signed-by=/usr/share/keyrings/tarsnap-archive-keyring.gpg] http://pkg.tarsnap.com/deb-src ./" | tee -a /etc/apt/sources.list.d/tarsnap.list && \
apt update -y && \
gpg --no-default-keyring --keyring trustedkeys.gpg --import /usr/share/keyrings/tarsnap-archive-keyring.gpg && \
apt build-dep -y tarsnap && \
apt source -b tarsnap && \
dpkg -i tarsnap_*.deb

# prepare build dir
RUN mkdir /app
WORKDIR /app

# install hex + rebar
Expand All @@ -29,16 +54,25 @@ COPY rel rel
RUN mix do sentry.package_source_code, release

# prepare release image
FROM alpine:3.16.2 AS app
RUN apk add --no-cache bash build-base coreutils curl docker gzip libffi-dev openssl openssl-dev pigz python3-dev py3-pip rust tar tarsnap wget zip
FROM debian:${DEBIAN_VERSION} AS app

RUN apt update -y && \
apt install --no-install-recommends -y apt-transport-https awscli bash build-essential ca-certificates coreutils curl docker gnupg gzip libffi-dev libssl-dev openssl pigz python3-dev tar zip

RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \
apt update -y && apt install --no-install-recommends -y google-cloud-cli

RUN pip install --no-cache-dir --upgrade awscli gsutil
COPY --from=build /usr/bin/tarsnap* /usr/bin

COPY etc/tarsnap.conf /etc/tarsnap/tarsnap.conf
COPY etc/boto /app/.boto

WORKDIR /app

COPY --from=build /app/_build/prod/rel/bob ./
RUN chown -R nobody: /app
USER nobody

ENV HOME=/app
ENV LANG=C.UTF-8
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Bob.Mixfile do
[
app: :bob,
version: "0.0.1",
elixir: "~> 1.8",
elixir: "~> 1.18",
start_permanent: Mix.env() == :prod,
build_embedded: Mix.env() == :prod,
releases: releases(),
Expand Down

0 comments on commit 422b2ff

Please sign in to comment.