-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
44 lines (31 loc) · 1.03 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# use Node 18 image as a builder
FROM node:18-alpine AS builder
# work under the /app directory
WORKDIR /app
# copy files required to install dependencies first
COPY package.json package-lock.json svelte.config.js ./
# install the dependencies, including dev ones.
# SvelteKit package itself is a dev dependency and we need it for building the app.
RUN npm ci
# copy all the sources
COPY . .
# build the app
RUN npm run build
# delete all the dev dependencies from the "node_modules",
# they are no longer needed.
RUN npm prune --production
# take the distroless Node 18 image
FROM gcr.io/distroless/nodejs18-debian11
# work under the /app directory
WORKDIR /app
# copy the built app, dependencies and the package file
# as described in the Svelte adapter-node docs
COPY --from=builder /app/build server/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
# expose the app server port
EXPOSE 3000
# tell Node and other code this is production
ENV NODE_ENV=production
# run the app server (entrypoint is node)
CMD ["server"]