From b4733a012c6323210470dce4272dba3217379b53 Mon Sep 17 00:00:00 2001 From: Kian Kasad Date: Sat, 11 Oct 2025 22:31:46 -0400 Subject: [PATCH] build: use Alpine as base image --- .dockerignore | 3 +++ Dockerfile | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index dadddee..ecd3bb7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,6 @@ +# CI workflows +.github/ + # flyctl launch added from .gitignore # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore diff --git a/Dockerfile b/Dockerfile index a1c3f62..427f580 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM oven/bun AS build +FROM docker.io/oven/bun:1-alpine AS builder + +RUN apk add python3 build-base WORKDIR /app @@ -9,14 +11,17 @@ RUN bun install --frozen-lockfile COPY src ./src -RUN bun build ./src/index.ts --compile --outfile bot +RUN bun build --compile --sourcemap --outfile bot ./src/index.ts + +FROM docker.io/alpine:3 -FROM ubuntu:22.04 +# For some reason, Bun single-file executables targeting musl require libstdc++ +RUN apk --no-cache add libstdc++ WORKDIR /app -COPY --from=build /app/bot /app/bot +COPY --from=builder /app/bot /app/bot ENV TZ=America/Indiana/Indianapolis -CMD ["/app/bot"] +ENTRYPOINT ["/app/bot"]