mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-23 18:29:19 -05:00
build(docker): setup rootless image (#2032) [skip ci]
* build(docker): setup rootless image --------- Signed-off-by: Ludovic Ortega <ludovic.ortega@adminafk.fr>
This commit is contained in:
@@ -11,16 +11,19 @@
|
|||||||
.husky
|
.husky
|
||||||
.next
|
.next
|
||||||
.prettierignore
|
.prettierignore
|
||||||
|
.vscode
|
||||||
|
charts
|
||||||
config/db/*
|
config/db/*
|
||||||
config/logs/*
|
config/logs/*
|
||||||
config/*.json
|
config/*.json
|
||||||
|
cypress
|
||||||
dist
|
dist
|
||||||
Dockerfile*
|
Dockerfile*
|
||||||
compose.yaml
|
compose.yaml
|
||||||
|
gen-docs
|
||||||
docs
|
docs
|
||||||
LICENSE
|
LICENSE
|
||||||
node_modules
|
node_modules
|
||||||
public/os_logo_filled.png
|
public/os_logo_filled.png
|
||||||
public/preview.jpg
|
public/preview.jpg
|
||||||
stylelint.config.js
|
stylelint.config.js
|
||||||
cypress
|
|
||||||
|
|||||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
env:
|
env:
|
||||||
HUSKY: 0
|
CI: true
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
|
|||||||
49
Dockerfile
49
Dockerfile
@@ -1,15 +1,20 @@
|
|||||||
FROM node:22.20.0-alpine3.22@sha256:cb3143549582cc5f74f26f0992cdef4a422b22128cb517f94173a5f910fa4ee7 AS build_image
|
FROM node:22.20.0-alpine3.22@sha256:cb3143549582cc5f74f26f0992cdef4a422b22128cb517f94173a5f910fa4ee7 AS base
|
||||||
|
|
||||||
ARG SOURCE_DATE_EPOCH
|
ARG SOURCE_DATE_EPOCH
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG COMMIT_TAG
|
|
||||||
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
|
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
|
||||||
ENV COMMIT_TAG=${COMMIT_TAG}
|
|
||||||
|
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
|
COPY . ./app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM base AS prod-deps
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store CI=true pnpm install --prod --frozen-lockfile
|
||||||
|
|
||||||
|
FROM base as build
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
case "${TARGETPLATFORM}" in \
|
case "${TARGETPLATFORM}" in \
|
||||||
'linux/arm64' | 'linux/arm/v7') \
|
'linux/arm64' | 'linux/arm/v7') \
|
||||||
@@ -19,34 +24,32 @@ RUN \
|
|||||||
;; \
|
;; \
|
||||||
esac
|
esac
|
||||||
|
|
||||||
WORKDIR /app
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store CYPRESS_INSTALL_BINARY=0 pnpm install --frozen-lockfile
|
||||||
|
|
||||||
COPY package.json pnpm-lock.yaml postinstall-win.js ./
|
|
||||||
RUN CYPRESS_INSTALL_BINARY=0 pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
COPY . ./
|
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
# remove development dependencies
|
RUN rm -rf .next/cache
|
||||||
RUN pnpm prune --prod --ignore-scripts && \
|
|
||||||
rm -rf src server .next/cache charts gen-docs docs && \
|
|
||||||
touch config/DOCKER && \
|
|
||||||
echo "{\"commitTag\": \"${COMMIT_TAG}\"}" > committag.json
|
|
||||||
|
|
||||||
FROM node:22.20.0-alpine3.22@sha256:cb3143549582cc5f74f26f0992cdef4a422b22128cb517f94173a5f910fa4ee7
|
FROM node:22.20.0-alpine3.22@sha256:cb3143549582cc5f74f26f0992cdef4a422b22128cb517f94173a5f910fa4ee7
|
||||||
|
ARG SOURCE_DATE_EPOCH
|
||||||
|
ARG COMMIT_TAG
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV COMMIT_TAG=${COMMIT_TAG}
|
||||||
|
|
||||||
ENV PNPM_HOME="/pnpm"
|
RUN apk add --no-cache tzdata
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
|
||||||
RUN corepack enable
|
USER node:node
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apk add --no-cache tzdata tini && rm -rf /tmp/*
|
COPY --chown=node:node . .
|
||||||
|
COPY --chown=node:node --from=prod-deps /app/node_modules ./node_modules
|
||||||
|
COPY --chown=node:node --from=build /app/.next ./.next
|
||||||
|
COPY --chown=node:node --from=build /app/dist ./dist
|
||||||
|
|
||||||
# copy from build image
|
RUN touch config/DOCKER && \
|
||||||
COPY --from=build_image /app ./
|
echo "{\"commitTag\": \"${COMMIT_TAG}\"}" > committag.json
|
||||||
|
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
|
||||||
CMD [ "pnpm", "start" ]
|
|
||||||
|
|
||||||
EXPOSE 5055
|
EXPOSE 5055
|
||||||
|
|
||||||
|
CMD [ "npm", "start" ]
|
||||||
|
|||||||
9
bin/prepare.js
Normal file
9
bin/prepare.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not run husky in CI environments
|
||||||
|
*/
|
||||||
|
const isCi = process.env.CI !== undefined;
|
||||||
|
if (!isCi) {
|
||||||
|
require('husky').install();
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ For details on the Docker CLI, please [review the official `docker run` document
|
|||||||
```bash
|
```bash
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name jellyseerr \
|
--name jellyseerr \
|
||||||
|
--init \
|
||||||
-e LOG_LEVEL=debug \
|
-e LOG_LEVEL=debug \
|
||||||
-e TZ=Asia/Tashkent \
|
-e TZ=Asia/Tashkent \
|
||||||
-e PORT=5055 \
|
-e PORT=5055 \
|
||||||
@@ -85,6 +86,7 @@ Define the `jellyseerr` service in your `compose.yaml` as follows:
|
|||||||
services:
|
services:
|
||||||
jellyseerr:
|
jellyseerr:
|
||||||
image: fallenbagel/jellyseerr:latest
|
image: fallenbagel/jellyseerr:latest
|
||||||
|
init: true
|
||||||
container_name: jellyseerr
|
container_name: jellyseerr
|
||||||
environment:
|
environment:
|
||||||
- LOG_LEVEL=debug
|
- LOG_LEVEL=debug
|
||||||
@@ -156,6 +158,7 @@ Then, create and start the Jellyseerr container:
|
|||||||
```bash
|
```bash
|
||||||
docker run -d \
|
docker run -d \
|
||||||
--name jellyseerr \
|
--name jellyseerr \
|
||||||
|
--init \
|
||||||
-e LOG_LEVEL=debug \
|
-e LOG_LEVEL=debug \
|
||||||
-e TZ=Asia/Tashkent \
|
-e TZ=Asia/Tashkent \
|
||||||
-e PORT=5055 \
|
-e PORT=5055 \
|
||||||
@@ -193,6 +196,7 @@ docker compose up -d
|
|||||||
services:
|
services:
|
||||||
jellyseerr:
|
jellyseerr:
|
||||||
image: fallenbagel/jellyseerr:latest
|
image: fallenbagel/jellyseerr:latest
|
||||||
|
init: true
|
||||||
container_name: jellyseerr
|
container_name: jellyseerr
|
||||||
environment:
|
environment:
|
||||||
- LOG_LEVEL=debug
|
- LOG_LEVEL=debug
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"typecheck": "pnpm typecheck:server && pnpm typecheck:client",
|
"typecheck": "pnpm typecheck:server && pnpm typecheck:client",
|
||||||
"typecheck:server": "tsc --project server/tsconfig.json --noEmit",
|
"typecheck:server": "tsc --project server/tsconfig.json --noEmit",
|
||||||
"typecheck:client": "tsc --noEmit",
|
"typecheck:client": "tsc --noEmit",
|
||||||
"prepare": "husky install",
|
"prepare": "node bin/prepare.js",
|
||||||
"cypress:open": "cypress open",
|
"cypress:open": "cypress open",
|
||||||
"cypress:prepare": "ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/scripts/prepareTestDb.ts",
|
"cypress:prepare": "ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/scripts/prepareTestDb.ts",
|
||||||
"cypress:build": "pnpm build && pnpm cypress:prepare"
|
"cypress:build": "pnpm build && pnpm cypress:prepare"
|
||||||
|
|||||||
Reference in New Issue
Block a user