refactor: Dockerfile replace debian with alpine

This commit is contained in:
sjdonado
2025-11-02 10:29:08 +01:00
parent 52497235b9
commit 6f5ad76718
+18 -22
View File
@@ -1,41 +1,37 @@
FROM debian:bookworm-slim AS build FROM alpine:edge AS build
ARG TARGETARCH
ENV ENV=production ENV ENV=production
WORKDIR /usr/src/app WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y \ RUN apk add --no-cache \
curl \
gnupg \
ca-certificates \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://packagecloud.io/84codes/crystal/gpgkey | gpg --dearmor > /etc/apt/trusted.gpg.d/84codes_crystal.gpg \
&& echo "deb [signed-by=/etc/apt/trusted.gpg.d/84codes_crystal.gpg] https://packagecloud.io/84codes/crystal/debian/ bookworm main" > /etc/apt/sources.list.d/84codes_crystal.list
RUN apt-get update && apt-get install -y \
crystal \ crystal \
libssl-dev \ shards \
libyaml-dev \ openssl-dev \
libsqlite3-dev \ yaml-dev \
sqlite-dev \
libevent-dev \ libevent-dev \
&& rm -rf /var/lib/apt/lists/* tzdata
COPY . . COPY . .
RUN shards install --production RUN shards install --production
RUN shards build --release --no-debug --progress --stats RUN shards build --release --no-debug --progress --stats
FROM debian:bookworm-slim AS runtime FROM alpine:latest AS runtime
ENV ENV=production ENV ENV=production
WORKDIR /usr/src/app WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y \ RUN apk add --no-cache \
libssl3 \ gc-dev \
libyaml-0-2 \ pcre2 \
sqlite3 \ libevent \
libevent-2.1-7 \ sqlite-libs \
&& rm -rf /var/lib/apt/lists/* openssl \
yaml \
gmp \
libgcc \
tzdata
RUN mkdir -p sqlite RUN mkdir -p sqlite