generated from michael/editable-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (32 loc) · 1.09 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
FROM node:18-slim AS builder
RUN mkdir /app
# NodeJS app lives here
WORKDIR /app
# Install packages needed to build node modules
RUN apt update -qq && \
apt install -y python-is-python3 pkg-config build-essential
# Install node modules
COPY package.json package-lock.json ./
RUN npm ci --omit dev
# copy source across (excludes items filtered by .dockerignore)
COPY . .
RUN mkdir data
RUN --mount=type=secret,id=DB_PATH \
--mount=type=secret,id=ADMIN_PASSWORD \
--mount=type=secret,id=ORIGIN \
DB_PATH="$(cat /run/secrets/DB_PATH)" \
ADMIN_PASSWORD="$(cat /run/secrets/ADMIN_PASSWORD)" \
ORIGIN="$(cat /run/secrets/ORIGIN)" \
npm run build
FROM node:18-slim AS runner
RUN apt update -qq && \
apt install -y sqlite3
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/build /app/build
COPY --from=builder /app/package.json /app
COPY --from=builder /app/scripts/fly-start.sh /app
COPY --from=builder /app/sql/schema.sql /app
WORKDIR /app
ENV NODE_ENV production
# Start the server by default, this can be overwritten at runtime
CMD [ "node", "build" ]