mirror of
https://github.com/seerr-team/seerr.git
synced 2025-12-23 23:58:07 -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
|
||||
.next
|
||||
.prettierignore
|
||||
.vscode
|
||||
charts
|
||||
config/db/*
|
||||
config/logs/*
|
||||
config/*.json
|
||||
cypress
|
||||
dist
|
||||
Dockerfile*
|
||||
compose.yaml
|
||||
gen-docs
|
||||
docs
|
||||
LICENSE
|
||||
node_modules
|
||||
public/os_logo_filled.png
|
||||
public/preview.jpg
|
||||
stylelint.config.js
|
||||
cypress
|
||||
|
||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
HUSKY: 0
|
||||
CI: true
|
||||
run: pnpm install
|
||||
|
||||
- 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 TARGETPLATFORM
|
||||
ARG COMMIT_TAG
|
||||
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
|
||||
ENV COMMIT_TAG=${COMMIT_TAG}
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
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 \
|
||||
case "${TARGETPLATFORM}" in \
|
||||
'linux/arm64' | 'linux/arm/v7') \
|
||||
@@ -19,34 +24,32 @@ RUN \
|
||||
;; \
|
||||
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
|
||||
|
||||
# remove development dependencies
|
||||
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
|
||||
RUN rm -rf .next/cache
|
||||
|
||||
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"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
RUN apk add --no-cache tzdata
|
||||
|
||||
USER node:node
|
||||
|
||||
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
|
||||
COPY --from=build_image /app ./
|
||||
|
||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
||||
CMD [ "pnpm", "start" ]
|
||||
RUN touch config/DOCKER && \
|
||||
echo "{\"commitTag\": \"${COMMIT_TAG}\"}" > committag.json
|
||||
|
||||
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
|
||||
docker run -d \
|
||||
--name jellyseerr \
|
||||
--init \
|
||||
-e LOG_LEVEL=debug \
|
||||
-e TZ=Asia/Tashkent \
|
||||
-e PORT=5055 \
|
||||
@@ -85,6 +86,7 @@ Define the `jellyseerr` service in your `compose.yaml` as follows:
|
||||
services:
|
||||
jellyseerr:
|
||||
image: fallenbagel/jellyseerr:latest
|
||||
init: true
|
||||
container_name: jellyseerr
|
||||
environment:
|
||||
- LOG_LEVEL=debug
|
||||
@@ -156,6 +158,7 @@ Then, create and start the Jellyseerr container:
|
||||
```bash
|
||||
docker run -d \
|
||||
--name jellyseerr \
|
||||
--init \
|
||||
-e LOG_LEVEL=debug \
|
||||
-e TZ=Asia/Tashkent \
|
||||
-e PORT=5055 \
|
||||
@@ -193,6 +196,7 @@ docker compose up -d
|
||||
services:
|
||||
jellyseerr:
|
||||
image: fallenbagel/jellyseerr:latest
|
||||
init: true
|
||||
container_name: jellyseerr
|
||||
environment:
|
||||
- LOG_LEVEL=debug
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"typecheck": "pnpm typecheck:server && pnpm typecheck:client",
|
||||
"typecheck:server": "tsc --project server/tsconfig.json --noEmit",
|
||||
"typecheck:client": "tsc --noEmit",
|
||||
"prepare": "husky install",
|
||||
"prepare": "node bin/prepare.js",
|
||||
"cypress:open": "cypress open",
|
||||
"cypress:prepare": "ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/scripts/prepareTestDb.ts",
|
||||
"cypress:build": "pnpm build && pnpm cypress:prepare"
|
||||
|
||||
Reference in New Issue
Block a user