Skip to content

Commit

Permalink
fix(docker): prebuilt dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thib3113 committed Nov 12, 2023
1 parent c92577d commit 3831683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
19 changes: 7 additions & 12 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:lts-alpine as builder

RUN apk add --no-cache build-base python3 py3-pip make
RUN apk add --no-cache build-base python3 py3-pip make jq

RUN npm install -g npm && \
npm install -g pnpm
Expand All @@ -12,28 +12,23 @@ RUN mkdir -p /tmp/src
COPY . /tmp/src

RUN cd /tmp/src && \
echo "node-linker=hoisted" >> .npmrc &&\
pnpm install --frozen-lockfile && \
pnpm build && \
mv build /app && \
mv package.json /app
pnpm prune --prod && \
for file in $(jq -r '.files[]' package.json); do cp -R $file /app/$file; done && \
cp package.json /app/ && \
cp -R node_modules /app/

RUN rm -Rf /tmp/src

FROM node:lts-alpine
LABEL maintainer="thibaut severac <thib3113@gmail.com>"
WORKDIR /app

RUN apk add --no-cache build-base python3 py3-pip make

COPY --from=builder /app .

RUN npm install -g npm && \
npm install -g pnpm
RUN pnpm install -P

RUN npm remove -g pnpm yarn &&\
npm cache clean --force &&\
apk del build-base python3 py3-pip make
RUN npm install -g npm

COPY ./docker/entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"unifi-client": "0.11.0",
"winston": "^3.11.0"
},
"files": ["build", "ecosystem.config.js"],
"devDependencies": {
"@tsconfig/node14": "14.1.0",
"@types/express": "4.17.21",
Expand Down

0 comments on commit 3831683

Please sign in to comment.