mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-26 16:30:57 +01:00
fix: deployment pipeline for docker not working (#860)
* fix: skip env validation in dockerfile not working * fix: skip env validation in dockerfile not working * fix: remove linux/arm/v7 for now as node commands are run forever * fix: remove cache because it is to big? * refactor: remove redis log transport during build * fix: add more checks for conditional redis connection * fix: docker build not working locally * refactor: move base image to debian * chore: add arm v7 platform support * fix: remove armv7 support as not supported by turbo * chore: profile amd64 build * chore: enable webpack logging * chore: disable linux/arm64 for now * chore: remove profiling from build in dockerfile * chore: revert to node alpine image
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -1 +1 @@
|
||||
docker run -p 3000:3000 -p 3001:3001 homarr:latest
|
||||
docker run -p 3000:3000 -p 3001:3001 -e AUTH_SECRET='secrets' homarr:latest
|
||||
@@ -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 };
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"AUTH_PROVIDERS",
|
||||
"AUTH_SECRET",
|
||||
"CI",
|
||||
"DISABLE_REDIS_LOGS",
|
||||
"DB_URL",
|
||||
"DB_HOST",
|
||||
"DB_USER",
|
||||
|
||||
Reference in New Issue
Block a user