mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-05-24 01:13:00 -04:00
Merge pull request #4150 from pinjeff/docker-build
Reduce final docker image size
This commit is contained in:
commit
5cadc8d90f
31
Dockerfile
31
Dockerfile
@ -1,29 +1,25 @@
|
|||||||
### STAGE 0: Build client ###
|
### STAGE 0: Build client ###
|
||||||
FROM node:20-alpine AS build
|
FROM node:20-alpine AS build-client
|
||||||
WORKDIR /client
|
WORKDIR /client
|
||||||
COPY /client /client
|
COPY /client /client
|
||||||
RUN npm ci && npm cache clean --force
|
RUN npm ci && npm cache clean --force
|
||||||
RUN npm run generate
|
RUN npm run generate
|
||||||
|
|
||||||
### STAGE 1: Build server ###
|
### STAGE 1: Build server ###
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine AS build-server
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
RUN apk update && \
|
RUN apk add --no-cache --update \
|
||||||
apk add --no-cache --update \
|
|
||||||
curl \
|
curl \
|
||||||
tzdata \
|
|
||||||
ffmpeg \
|
|
||||||
make \
|
make \
|
||||||
python3 \
|
python3 \
|
||||||
g++ \
|
g++ \
|
||||||
tini \
|
|
||||||
unzip
|
unzip
|
||||||
|
|
||||||
COPY --from=build /client/dist /client/dist
|
WORKDIR /server
|
||||||
COPY index.js package* /
|
COPY index.js package* /server
|
||||||
COPY server server
|
COPY /server /server/server
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
@ -42,7 +38,20 @@ RUN case "$TARGETPLATFORM" in \
|
|||||||
|
|
||||||
RUN npm ci --only=production
|
RUN npm ci --only=production
|
||||||
|
|
||||||
RUN apk del make python3 g++
|
### STAGE 2: Create minimal runtime image ###
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
# Install only runtime dependencies
|
||||||
|
RUN apk add --no-cache --update \
|
||||||
|
tzdata \
|
||||||
|
ffmpeg \
|
||||||
|
tini
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy compiled frontend and server from build stages
|
||||||
|
COPY --from=build-client /client/dist /app/client/dist
|
||||||
|
COPY --from=build-server /server /app
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
0
tailwind.config.js
Normal file
0
tailwind.config.js
Normal file
Loading…
x
Reference in New Issue
Block a user