FROM denoland/deno:alpine as prod

ENV NODE_ENV=production

EXPOSE 8080

VOLUME /plugins
VOLUME /views
VOLUME /static
VOLUME /config

STOPSIGNAL SIGINT

HEALTHCHECK --interval=30s --start-period=1s CMD curl localhost:8080/.well-known/keepalive | grep "awake and alive"
ENTRYPOINT deno run\
    --allow-read=config.dev.yml\
    --allow-read=config.test.yml\
    --allow-net=0.0.0.0:8080\
    --allow-sys=homedir\
    --allow-read=./\
    --allow-read=/plugins\
    --allow-read=/views\
    --allow-read=/static\
    --allow-read=/config\
    /app/src/main.ts\
    /app/config.yml\
    $(find /config -name "*.yml")

WORKDIR /app

COPY deno.json ./
RUN deno install

COPY src ./src/