Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor dockerfile and add clean-up command #833

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 32 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
# Build image
FROM node:20-alpine AS BUILD_IMAGE

WORKDIR /app

ARG TARGETPLATFORM
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}

RUN \
case "${TARGETPLATFORM}" in \
'linux/arm64' | 'linux/arm/v7') \
apk update && \
apk add --no-cache python3 make g++ gcc libc6-compat bash && \
npm install --global node-gyp \
;; \
esac

Run npm install --global pnpm
# Install OS dependencies
RUN case "${TARGETPLATFORM}" in \
'linux/arm64' | 'linux/arm/v7') \
apk update \
&& apk add --no-cache \
python3 \
make \
g++ \
gcc \
libc6-compat \
bash \
&& npm install --global node-gyp \
;; \
esac

# Install npm dependencies
RUN npm install --global pnpm

COPY package.json pnpm-lock.yaml ./
RUN CYPRESS_INSTALL_BINARY=0 pnpm install --frozen-lockfile

COPY . ./

# Git commit tag
ARG COMMIT_TAG
ENV COMMIT_TAG=${COMMIT_TAG}

RUN pnpm build

# remove development dependencies
# Remove development dependencies
RUN pnpm prune --prod --ignore-scripts

RUN rm -rf src server .next/cache
Expand All @@ -35,20 +44,26 @@ RUN touch config/DOCKER

RUN echo "{\"commitTag\": \"${COMMIT_TAG}\"}" > committag.json


FROM node:20-alpine
# Runtime image
FROM node:20-alpine AS RUNTIME_IMAGE

# Metadata for Github Package Registry
LABEL org.opencontainers.image.source="https://github.com/Fallenbagel/jellyseerr"
LABEL org.opencontainers.image.title="Jellyseerr"
LABEL org.opencontainers.image.description="Fork of Overseerr for Jellyfin support"

WORKDIR /app

RUN apk add --no-cache tzdata tini && rm -rf /tmp/*
# Add other dependencies and clean-up
RUN apk add --no-cache \
tzdata \
tini \
&& apk cache clean \
&& rm -rf /tmp/* /var/cache/apk/*

# copy from build image
# Copy from build image
COPY --from=BUILD_IMAGE /app ./

EXPOSE 5055
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "pnpm", "start" ]

EXPOSE 5055
2 changes: 1 addition & 1 deletion Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:20-alpine
COPY . /app
WORKDIR /app

Run npm install --global pnpm
RUN npm install --global pnpm

RUN pnpm install

Expand Down
Loading