fix: add workaround for failing Docker build
This commit is contained in:
parent
03a8a52314
commit
b0f4c449ba
3 changed files with 33 additions and 4 deletions
|
|
@ -27,6 +27,8 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
|||
ENV DB_DRIVER="pglite"
|
||||
ENV DB_LOCATION="./data"
|
||||
|
||||
ENV IS_DOCKER_BUILD=true
|
||||
|
||||
RUN corepack enable pnpm && pnpm run build
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
services:
|
||||
inffo2:
|
||||
container_name: inffo2
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
DB_LOCATION: ${DB_LOCATION}
|
||||
build: .
|
||||
environment:
|
||||
AUTH_SECRET: ${AUTH_SECRET}
|
||||
AUTH_GITHUB_ID: ${AUTH_GITHUB_ID}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import { eventsTable, linesTable } from "./schema";
|
|||
const { db } = getDbInstance();
|
||||
|
||||
export async function saveLines(lines: Line[]) {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return; // Skip saving lines during Docker build
|
||||
}
|
||||
await db
|
||||
.insert(linesTable)
|
||||
.values(
|
||||
|
|
@ -27,10 +30,16 @@ export async function updateLineEvents(lineId: number, events: Event[]) {
|
|||
}
|
||||
|
||||
export async function getAllLines() {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return []; // Skip fetching lines during Docker build
|
||||
}
|
||||
return db.select().from(linesTable);
|
||||
}
|
||||
|
||||
export async function getLineById(lineId: number) {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return null; // Skip fetching line during Docker build
|
||||
}
|
||||
const line = await db
|
||||
.select()
|
||||
.from(linesTable)
|
||||
|
|
@ -43,6 +52,9 @@ export async function getLineById(lineId: number) {
|
|||
}
|
||||
|
||||
export async function getEventsForLine(lineId: number) {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return []; // Skip fetching events during Docker build
|
||||
}
|
||||
return db
|
||||
.select()
|
||||
.from(eventsTable)
|
||||
|
|
@ -51,6 +63,9 @@ export async function getEventsForLine(lineId: number) {
|
|||
}
|
||||
|
||||
export async function getEventsByIds(eventIds: number[]) {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return []; // Skip fetching events during Docker build
|
||||
}
|
||||
if (eventIds.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -62,10 +77,16 @@ export async function getEventsByIds(eventIds: number[]) {
|
|||
}
|
||||
|
||||
export async function getAllEvents() {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return []; // Skip fetching events during Docker build
|
||||
}
|
||||
return db.select().from(eventsTable).orderBy(eventsTable.startTime);
|
||||
}
|
||||
|
||||
export async function getAllDays() {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return []; // Skip fetching days during Docker build
|
||||
}
|
||||
const events = await getAllEvents();
|
||||
const days = new Set<string>();
|
||||
|
||||
|
|
@ -78,6 +99,9 @@ export async function getAllDays() {
|
|||
}
|
||||
|
||||
export async function getEventsForDate(date: string) {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return []; // Skip fetching events during Docker build
|
||||
}
|
||||
const startOfDay = new Date(date);
|
||||
startOfDay.setHours(6, 0, 0, 0);
|
||||
const endOfDay = new Date(date);
|
||||
|
|
@ -96,6 +120,9 @@ export async function getEventsForDate(date: string) {
|
|||
}
|
||||
|
||||
export async function getEventById(eventId: number) {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return null; // Skip fetching event during Docker build
|
||||
}
|
||||
const event = await db
|
||||
.select()
|
||||
.from(eventsTable)
|
||||
|
|
@ -108,6 +135,9 @@ export async function getEventById(eventId: number) {
|
|||
}
|
||||
|
||||
export async function searchEvents(query: string) {
|
||||
if (process.env.IS_DOCKER_BUILD === "true") {
|
||||
return []; // Skip searching events during Docker build
|
||||
}
|
||||
return await db
|
||||
.select()
|
||||
.from(eventsTable)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue