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