-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
46 lines (34 loc) · 1.32 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
44
45
46
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-slim AS base
RUN apt-get update && apt-get upgrade -y && apt-get install -y ca-certificates \
&& apt-get install -y sqlite3 libsqlite3-dev
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build
FROM base AS runtime
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
# Move the drizzle directory to the runtime image
COPY --from=build /app/drizzle ./drizzle
COPY --from=build /app/scripts ./scripts
# Move the litestream binary to the runtime image from the litestream image
# You can use a specific version of litestream by changing the tag
# COPY --from=litestream/litestream:0.3.13 /usr/local/bin/litestream /usr/local/bin/litestream
COPY --from=litestream/litestream:latest /usr/local/bin/litestream /usr/local/bin/litestream
# Move the run script and litestream config to the runtime image
COPY --from=build /app/scripts/run.sh run.sh
COPY --from=build /app/litestream.yml /etc/litestream.yml
RUN chmod +x run.sh
# Create the data directory for the database
RUN mkdir -p /data
ENV HOST=0.0.0.0
ENV PORT=4321
ENV NODE_ENV=production
EXPOSE 4321
CMD ["sh", "run.sh"]