diff --git a/.github/workflows/deployment-docker-image.yml b/.github/workflows/deployment-docker-image.yml index 6121cd187..e38392eb7 100644 --- a/.github/workflows/deployment-docker-image.yml +++ b/.github/workflows/deployment-docker-image.yml @@ -63,10 +63,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: "pnpm" - - name: Install dependencies - run: pnpm install - - name: Build artifacts - run: pnpm build - name: Discord notification if: ${{ github.events.inputs.send-notifications }} env: @@ -90,13 +86,11 @@ jobs: id: buildPushAction uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/amd64 # we currently do't build for linux/arm64 as it's really slow and we'll move to a self hosted runner for that or use the official github runner, once it's available context: . push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max network: host env: SKIP_ENV_VALIDATION: true diff --git a/Dockerfile b/Dockerfile index f224dce30..845d978c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM node:20.16.0-alpine AS base FROM base AS builder RUN apk add --no-cache libc6-compat RUN apk update + # Set working directory WORKDIR /app COPY . . @@ -35,6 +36,7 @@ RUN corepack enable pnpm && pnpm install COPY --from=builder /app/next-out/json/ . COPY --from=builder /app/next-out/pnpm-lock.yaml ./pnpm-lock.yaml +RUN corepack enable pnpm && pnpm install RUN corepack enable pnpm && pnpm install sharp -w @@ -46,8 +48,9 @@ COPY --from=builder /app/migration-out/full/ . # Copy static data as it is not part of the build COPY static-data ./static-data -ARG SKIP_ENV_VALIDATION=true -RUN corepack enable pnpm && pnpm turbo run build +ARG SKIP_ENV_VALIDATION='true' +ARG DISABLE_REDIS_LOGS='true' +RUN corepack enable pnpm && pnpm build FROM base AS runner WORKDIR /app @@ -84,6 +87,6 @@ COPY --chown=nextjs:nodejs packages/redis/redis.conf /app/redis.conf ENV DB_URL='/appdata/db/db.sqlite' ENV DB_DIALECT='sqlite' ENV DB_DRIVER='better-sqlite3' -ENV AUTH_PROVIDERS=credentials +ENV AUTH_PROVIDERS='credentials' CMD ["sh", "run.sh"] diff --git a/apps/nextjs/next.config.mjs b/apps/nextjs/next.config.mjs index 0cc05f786..6dcb85464 100644 --- a/apps/nextjs/next.config.mjs +++ b/apps/nextjs/next.config.mjs @@ -9,11 +9,14 @@ const config = { /** We already do linting and typechecking as separate tasks in CI */ eslint: { ignoreDuringBuilds: true }, typescript: { ignoreBuildErrors: true }, - webpack: (config) => { - config.module.rules.push({ - test: /\.node$/, - loader: "node-loader", - }); + webpack: (config, { isServer }) => { + if (isServer) { + config.module.rules.push({ + test: /\.node$/, + loader: "node-loader", + }); + } + return config; }, experimental: { diff --git a/development/docker-run.cmd b/development/docker-run.cmd index 36d3c7510..4c734fd9d 100644 --- a/development/docker-run.cmd +++ b/development/docker-run.cmd @@ -1 +1 @@ -docker run -p 3000:3000 -p 3001:3001 homarr:latest \ No newline at end of file +docker run -p 3000:3000 -p 3001:3001 -e AUTH_SECRET='secrets' homarr:latest \ No newline at end of file diff --git a/packages/log/src/index.mjs b/packages/log/src/index.mjs index 1ef0b09d2..030745eb6 100644 --- a/packages/log/src/index.mjs +++ b/packages/log/src/index.mjs @@ -6,9 +6,16 @@ const logMessageFormat = format.printf(({ level, message, timestamp }) => { return `${timestamp} ${level}: ${message}`; }); +const logTransports = [new transports.Console()]; + +// Only add the Redis transport if we are not in CI +if (!(Boolean(process.env.CI) || Boolean(process.env.DISABLE_REDIS_LOGS))) { + logTransports.push(new RedisTransport()); +} + const logger = winston.createLogger({ format: format.combine(format.colorize(), format.timestamp(), logMessageFormat), - transports: [new transports.Console(), new RedisTransport()], + transports: logTransports, }); export { logger }; diff --git a/packages/redis/src/lib/connection.ts b/packages/redis/src/lib/connection.ts index f006daafe..af6c05fac 100644 --- a/packages/redis/src/lib/connection.ts +++ b/packages/redis/src/lib/connection.ts @@ -4,4 +4,11 @@ import { Redis } from "ioredis"; * Creates a new Redis connection * @returns redis client */ -export const createRedisConnection = () => new Redis(); +export const createRedisConnection = () => { + if (Boolean(process.env.CI) || Boolean(process.env.DISABLE_REDIS_LOGS)) { + // Return null if we are in CI as we don't want to connect to Redis + return null as unknown as Redis; + } + + return new Redis(); +}; diff --git a/turbo.json b/turbo.json index 9d7bd177c..9be4b2792 100644 --- a/turbo.json +++ b/turbo.json @@ -25,6 +25,7 @@ "AUTH_PROVIDERS", "AUTH_SECRET", "CI", + "DISABLE_REDIS_LOGS", "DB_URL", "DB_HOST", "DB_USER",