FROM denoland/deno:alpine-2.1.4

ENV DATA_DIR=/app/data

WORKDIR /app

COPY . .

RUN apk add curl libstdc++ gtk+3.0 alsa-lib &&\
    deno run -A npm:playwright install firefox &&\
    deno install --allow-import --allow-ffi --allow-scripts=npm:sharp@0.33.5-rc.1 -e main.ts &&\
    sed -i -e 's/"deno"/"no-deno"/' node_modules/@libsql/client/package.json &&\
    mkdir -p $DATA_DIR

RUN deno task build

EXPOSE 8000

CMD ["run", "-A", "main.ts"]
