FROM debian:12

RUN apt-get update && \
    apt-get install -y libstdc++6 curl bash && \
		curl -fsSL https://bun.sh/install | bash && \
    apt-get clean

WORKDIR /app

# Cache packages installation
COPY package.json package.json
COPY bun.lock bun.lock

RUN bun install

ENV NODE_ENV=production
COPY ./src ./src
RUN bun build \
	--compile \
	--minify-whitespace \
	--minify-syntax \
	--outfile server \
	src/index.ts

CMD ["./server"]

EXPOSE 3000
