# This Dockerfile creates a build for all architectures
# Image that copies in the files and passes them to the main image
FROM alpine:3.16.2 AS copytask
#FROM ubuntu:focal AS copytask
ARG TARGETPLATFORM
# Move the output files to where they need to be
RUN mkdir /files
COPY _output/*.tar.gz /files/
COPY UI/Web/dist /files/wwwroot
COPY copy_runtime.sh /copy_runtime.sh
RUN /copy_runtime.sh
# Production image
FROM alpine:3.16.2
# FROM ubuntu:focal
COPY --from=copytask /Kavita /kavita
COPY --from=copytask /files/wwwroot /kavita/wwwroot
# Installs program dependencies
#RUN apt-get update \
# && apt-get install -y libicu-dev libssl1.1 libgdiplus curl \
# && rm -rf /var/lib/apt/lists/*
# in /etc/apk/repositories
# enable 3.16/community repo
# enable edge/testing repo (with tag @testing)
# https://wiki.alpinelinux.org/wiki/Package_management#Repository_pinning
# Use musl package
RUN apk add \
icu-dev libssl1.1 curl \
libgdiplus@testing
COPY entrypoint.sh /entrypoint.sh
EXPOSE 5000
WORKDIR /kavita
ENTRYPOINT [ "/bin/ash" ]
CMD ["/entrypoint.sh"]