48 lines
863 B
Text
48 lines
863 B
Text
|
###########
|
||
|
# Dev Stage
|
||
|
###########
|
||
|
FROM docker.io/denoland/deno:2.1.4 AS development
|
||
|
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Prevent including the wrong files by explicitly copying
|
||
|
# individual files and folders.
|
||
|
COPY components/ components/
|
||
|
COPY islands/ islands/
|
||
|
COPY routes/ routes/
|
||
|
COPY static/ static/
|
||
|
COPY deno.json dev.ts fresh.config.ts fresh.gen.ts main.ts tailwind.config.ts .
|
||
|
|
||
|
RUN mkdir /app/data
|
||
|
|
||
|
VOLUME /app/data
|
||
|
|
||
|
CMD ["run", "-A", "--watch=static/,routes/", "dev.ts"]
|
||
|
|
||
|
|
||
|
############
|
||
|
# Prod Stage
|
||
|
############
|
||
|
FROM docker.io/denoland/deno:2.1.4 AS production
|
||
|
|
||
|
COPY --from=development /app /app
|
||
|
|
||
|
WORKDIR /app
|
||
|
|
||
|
# Optimize build
|
||
|
RUN deno run -A dev.ts build
|
||
|
|
||
|
# Cache dependencies
|
||
|
RUN deno cache --allow-import main.ts
|
||
|
|
||
|
# Grant ownership of data folder to Deno user
|
||
|
RUN chown -R deno:deno /app/data
|
||
|
|
||
|
USER deno:deno
|
||
|
|
||
|
VOLUME /app/data
|
||
|
|
||
|
EXPOSE 8000
|
||
|
|
||
|
CMD ["run", "-A", "main.ts"]
|