Dockerfile

This commit is contained in:
Philippe Loctaux 2023-06-03 15:54:44 +02:00
parent 187621f8af
commit e81c8d8a86
2 changed files with 43 additions and 0 deletions

12
.dockerignore Normal file
View file

@ -0,0 +1,12 @@
/public/wallpapers.json
/dist/
/node_modules/
/.idea/
/.vscode/
.DS_Store
/readme.md
/Dockerfile
/.dockerignore

31
Dockerfile Normal file
View file

@ -0,0 +1,31 @@
ARG DENO_VERSION=1.34.1
# build wallpapers
FROM denoland/deno:alpine-${DENO_VERSION} as wallpapers
WORKDIR /wallpapers
COPY utils/wallpapers.ts .
COPY public/wallpapers ./wallpapers/
RUN deno run --allow-read --allow-net wallpapers.ts --sourceDir ./wallpapers/ --destinationDir /wallpapers > wallpapers.json
# build astro
FROM node:18.16-alpine as astro
WORKDIR /astro
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
COPY --from=wallpapers /wallpapers/wallpapers.json ./public/
RUN npm run build
# web server
FROM denoland/deno:alpine-${DENO_VERSION}
EXPOSE 8000
WORKDIR /web
COPY --from=astro /astro/dist .
RUN deno cache /web/server/entry.mjs
CMD ["run", "--allow-net", "--allow-read", "--allow-env", "/web/server/entry.mjs"]