From 2fd7fa4e23835304fac6a433d0dc57c4b9fb26ff Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Sun, 11 Feb 2024 02:01:20 +0000 Subject: upgrade pnpm and other deps (#98) * Use fixed version of GHA ubuntu runner to avoid "moving target" issues * Normalize GHA scripts parallel to ferdium-app repo --- Dockerfile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index df1c96a..d865ce1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,19 @@ -FROM node:20.11.0-alpine as build +FROM node:20.11.0-alpine as builder WORKDIR /server-build RUN apk add --no-cache python3 make gcc g++ libc-dev sqlite-dev -COPY . /server-build - ENV CI=true -RUN PNPM_VERSION=$(node -p 'require("./package.json").engines.pnpm'); npm i -g pnpm@$PNPM_VERSION + +COPY package*.json ./ +COPY .npmrc ./ + +RUN npm i -gf "pnpm@$(node -p 'require("./package.json").engines.pnpm')" && pnpm -v RUN pnpm install --config.build-from-source=sqlite --config.sqlite=/usr/local + +COPY . . + RUN pnpm build # ---- RUNTIME IMAGE ---------------------------------------------------------- @@ -20,12 +25,12 @@ LABEL maintainer="ferdium" # TODO: Shouldn't we set 'NODE_ENV=production' when running in production mode? ENV HOST=0.0.0.0 PORT=3333 DATA_DIR="/data" +# TODO: Are all these packages needed for the runtime image? RUN apk add --no-cache sqlite-libs curl su-exec python3 make g++ py3-pip git py3-pip sqlite # The next command is needed for sqlite3 install command executed by node-gyp # RUN ln -s /usr/bin/python3 /usr/bin/python - -COPY --from=build /server-build /app +COPY --from=builder /server-build /app RUN npm i -g @adonisjs/cli HEALTHCHECK --start-period=5s --interval=30s --retries=5 --timeout=3s CMD curl -sSf http://localhost:${PORT}/health -- cgit v1.2.3-54-g00ecf