FROM code.pztrn.name/containers/go-toolbox:v4 AS build

WORKDIR /featurer
COPY . /featurer
RUN --mount=type=cache,target="$GOCACHE" task server:cmd:cms:build

FROM debian:12.6-slim

RUN apt-get update && \
    apt-get install -y ca-certificates iputils-ping && \
    rm -rf /var/lib/apt/* /var/cache/apt/*

COPY --from=build /featurer/_build/featurer-cms /featurer-cms
COPY --from=build /usr/local/bin/dlv /dlv

COPY server/entrypoint-cms.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
