FROM debian:bullseye AS build

RUN apt-get update && \
	apt-get install -y --no-install-recommends \
		build-essential \
		libsodium-dev \
		libssl-dev

COPY . /app
RUN make -C /app -j $(nproc) release

FROM debian:bullseye
RUN apt-get update && \
	apt-get install -y --no-install-recommends \
		libsodium23 \
		libssl1.1
COPY --from=build /app/out/release/tildefriends /app/out/release/tildefriends
COPY --from=build /app/apps /app/apps
COPY --from=build /app/core /app/core
WORKDIR /app
EXPOSE 12345
CMD ["/app/out/release/tildefriends"]