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:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
- name: Build artifacts
|
|
||||||
run: pnpm build
|
|
||||||
- name: Discord notification
|
- name: Discord notification
|
||||||
if: ${{ github.events.inputs.send-notifications }}
|
if: ${{ github.events.inputs.send-notifications }}
|
||||||
env:
|
env:
|
||||||
@@ -90,13 +86,11 @@ jobs:
|
|||||||
id: buildPushAction
|
id: buildPushAction
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
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: .
|
context: .
|
||||||
push: false
|
push: false
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
network: host
|
network: host
|
||||||
env:
|
env:
|
||||||
SKIP_ENV_VALIDATION: true
|
SKIP_ENV_VALIDATION: true
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ FROM node:20.16.0-alpine AS base
|
|||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
RUN apk update
|
RUN apk update
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
@@ -35,6 +36,7 @@ RUN corepack enable pnpm && pnpm install
|
|||||||
|
|
||||||
COPY --from=builder /app/next-out/json/ .
|
COPY --from=builder /app/next-out/json/ .
|
||||||
COPY --from=builder /app/next-out/pnpm-lock.yaml ./pnpm-lock.yaml
|
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
|
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 as it is not part of the build
|
||||||
COPY static-data ./static-data
|
COPY static-data ./static-data
|
||||||
ARG SKIP_ENV_VALIDATION=true
|
ARG SKIP_ENV_VALIDATION='true'
|
||||||
RUN corepack enable pnpm && pnpm turbo run build
|
ARG DISABLE_REDIS_LOGS='true'
|
||||||
|
RUN corepack enable pnpm && pnpm build
|
||||||
|
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
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_URL='/appdata/db/db.sqlite'
|
||||||
ENV DB_DIALECT='sqlite'
|
ENV DB_DIALECT='sqlite'
|
||||||
ENV DB_DRIVER='better-sqlite3'
|
ENV DB_DRIVER='better-sqlite3'
|
||||||
ENV AUTH_PROVIDERS=credentials
|
ENV AUTH_PROVIDERS='credentials'
|
||||||
|
|
||||||
CMD ["sh", "run.sh"]
|
CMD ["sh", "run.sh"]
|
||||||
|
|||||||
@@ -9,11 +9,14 @@ const config = {
|
|||||||
/** We already do linting and typechecking as separate tasks in CI */
|
/** We already do linting and typechecking as separate tasks in CI */
|
||||||
eslint: { ignoreDuringBuilds: true },
|
eslint: { ignoreDuringBuilds: true },
|
||||||
typescript: { ignoreBuildErrors: true },
|
typescript: { ignoreBuildErrors: true },
|
||||||
webpack: (config) => {
|
webpack: (config, { isServer }) => {
|
||||||
config.module.rules.push({
|
if (isServer) {
|
||||||
test: /\.node$/,
|
config.module.rules.push({
|
||||||
loader: "node-loader",
|
test: /\.node$/,
|
||||||
});
|
loader: "node-loader",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
experimental: {
|
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}`;
|
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({
|
const logger = winston.createLogger({
|
||||||
format: format.combine(format.colorize(), format.timestamp(), logMessageFormat),
|
format: format.combine(format.colorize(), format.timestamp(), logMessageFormat),
|
||||||
transports: [new transports.Console(), new RedisTransport()],
|
transports: logTransports,
|
||||||
});
|
});
|
||||||
|
|
||||||
export { logger };
|
export { logger };
|
||||||
|
|||||||
@@ -4,4 +4,11 @@ import { Redis } from "ioredis";
|
|||||||
* Creates a new Redis connection
|
* Creates a new Redis connection
|
||||||
* @returns redis client
|
* @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_PROVIDERS",
|
||||||
"AUTH_SECRET",
|
"AUTH_SECRET",
|
||||||
"CI",
|
"CI",
|
||||||
|
"DISABLE_REDIS_LOGS",
|
||||||
"DB_URL",
|
"DB_URL",
|
||||||
"DB_HOST",
|
"DB_HOST",
|
||||||
"DB_USER",
|
"DB_USER",
|
||||||
|
|||||||
Reference in New Issue
Block a user