FROM alpine:3.14 AS base
RUN apk add xmlstarlet

FROM php:5.5-alpine
USER root
RUN apk update \
    && apk add \
        bash \
        unzip \
        ca-certificates \
        # xmlstarlet dependencies
        musl \
        libxslt \
        libxml2 \
        perl
RUN update-ca-certificates
RUN docker-php-ext-install mysql
COPY --from=base /usr/bin/xmlstarlet /usr/bin
COPY ./xaseco-entrypoint.sh /usr/local/bin/xaseco-foreground
COPY ./parser.patch /root/parser.patch
# Server dir
RUN mkdir /cache
# Override dir
RUN mkdir /data
# Merged dir
RUN mkdir -p /opt/xaseco
WORKDIR /opt/xaseco

ENV \
    MASTERADMIN_USER="" \
    MASTERADMIN_IP="" \
    \
    ADMINS="" \
    OPERATORS="" \
    \
    X1_EXTRA_PLUGINS="" \
    X1_DISABLED_PLUGINS="" \
    \
    TM_SERVER_HOST="" \
    TM_SERVER_PORT="" \
    TM_XMLRPC_PORT="" \
    TM_TIMEOUT="" \
    \
    TM_USER="" \
    TM_PASSWORD="" \
    TM_SUPERADMIN_PASSWORD="" \
    \
    MYSQL_HOST="" \
    MYSQL_USER="" \
    MYSQL_PASSWORD="" \
    MYSQL_DATABASE="" \
    \
    DEDI_URL="" \
    DEDI_NAME="" \
    DEDI_USER="" \
    DEDI_PASSWORD="" \
    DEDI_NATION="" \
    DEDI_LOG_NEWS="" \
    DEDI_SHOW_MOTD=""

ENTRYPOINT [ "xaseco-foreground" ]
CMD [ "php", "./aseco.php" ]