mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 22:01:13 +00:00
Clean up Dockerfile (#2314)
* Clean up Dockerfile * Reduce image size Recommended by @kroese
This commit is contained in:
parent
9aa19d8bbd
commit
a0add1e61c
1 changed files with 2 additions and 10 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,9 +1,5 @@
|
||||||
FROM node:20-alpine as builder
|
FROM node:20-alpine as builder
|
||||||
|
|
||||||
# Upgrade to edge to fix sharp/libvips issues
|
|
||||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories
|
|
||||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
|
|
||||||
|
|
||||||
# Added vips-dev and pkgconfig so that local vips is used instead of prebuilt
|
# Added vips-dev and pkgconfig so that local vips is used instead of prebuilt
|
||||||
# Done for two reasons:
|
# Done for two reasons:
|
||||||
# - libvips binaries are not available for ARM32
|
# - libvips binaries are not available for ARM32
|
||||||
|
@ -38,7 +34,7 @@ COPY .git .git
|
||||||
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
|
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
|
||||||
|
|
||||||
RUN yarn --production --prefer-offline --network-timeout 100000
|
RUN yarn --production --prefer-offline --network-timeout 100000
|
||||||
RUN NODE_OPTIONS="--max-old-space-size=8192" yarn build:prod
|
RUN yarn build:prod
|
||||||
|
|
||||||
RUN rm -rf ./node_modules/import-sort-parser-typescript
|
RUN rm -rf ./node_modules/import-sort-parser-typescript
|
||||||
RUN rm -rf ./node_modules/typescript
|
RUN rm -rf ./node_modules/typescript
|
||||||
|
@ -49,11 +45,7 @@ RUN du -sh ./node_modules/* | sort -nr | grep '\dM.*'
|
||||||
FROM node:20-alpine as runner
|
FROM node:20-alpine as runner
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
# Upgrade to edge to fix sharp/libvips issues
|
RUN apk update && apk add --no-cache curl vips-cpp && rm -rf /var/cache/apk/*
|
||||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories
|
|
||||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
|
|
||||||
|
|
||||||
RUN apk update && apk upgrade && apk add curl vips-cpp
|
|
||||||
|
|
||||||
COPY --from=builder /usr/src/app/dist /app/dist
|
COPY --from=builder /usr/src/app/dist /app/dist
|
||||||
COPY --from=builder /usr/src/app/node_modules /app/node_modules
|
COPY --from=builder /usr/src/app/node_modules /app/node_modules
|
||||||
|
|
Loading…
Reference in a new issue