FROM python:3.9-alpine

ADD . /
RUN apk --update add build-base libffi libffi-dev rust cargo \
  && mkdir -p /var/lib/easywks \
  && chown 1000:0 -R /var/lib/easywks \
  && chmod 0700 /var/lib/easywks \
  && pip3 install -e . \
  && mv /package/docker/entrypoint.sh /entrypoint.sh \
  && mv /package/docker/easywks.yml /etc/easywks.yml \
  && rm -rf /package \
  && apk del build-base libffi-dev rust cargo

USER 1000

EXPOSE 80/tcp
EXPOSE 24/tcp
CMD [ "/entrypoint.sh" ]