FROM ${image}

COPY ./instance .

COPY ./certificate.conf .

RUN apk add --no-cache \
    openssl

RUN mkdir ./https && \
    openssl req \
        -config ./certificate.conf \
        -days 365 \
        -keyout ./https/certificate.key \
        -new \
        -nodes \
        -out ./https/certificate.crt \
        -x509 && \
    openssl pkcs12 \
        -export \
        -in ./https/certificate.crt \
        -inkey ./https/certificate.key \
        -out ./https/certificate.pfx \
        -passout pass:fonto-connectors-certificate

RUN mkdir wwwroot && \
    mv editor/ wwwroot/editor/
