mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Fix docker build
This commit is contained in:
parent
dc17cffd75
commit
bfd394c21e
|
|
@ -8,7 +8,8 @@ FROM base AS install
|
|||
|
||||
# Install with --production (exclude devDependencies)
|
||||
RUN mkdir -p /temp
|
||||
COPY . /temp
|
||||
COPY package.json /temp
|
||||
COPY bun.lockb /temp
|
||||
WORKDIR /temp
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
# Use the latest Postgres Docker image based on Alpine
|
||||
FROM postgres:alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install curl
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
RUN cd "$(mktemp -d)" \
|
||||
&& curl -LO "https://github.com/fboulnois/pg_uuidv7/releases/download/v1.3.0/{pg_uuidv7.tar.gz,SHA256SUMS}" \
|
||||
&& tar xf pg_uuidv7.tar.gz \
|
||||
&& sha256sum -c SHA256SUMS \
|
||||
&& PG_MAJOR=$(pg_config --version | sed 's/^.* \([0-9]\{1,\}\).*$/\1/') \
|
||||
&& cp "$PG_MAJOR/pg_uuidv7.so" "$(pg_config --pkglibdir)" \
|
||||
&& cp sql/pg_uuidv7--1.3.sql pg_uuidv7.control "$(pg_config --sharedir)/extension"
|
||||
# Add a script to run the CREATE EXTENSION command
|
||||
RUN echo '#!/bin/sh\npsql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_uuidv7;"' > /docker-entrypoint-initdb.d/init.sh
|
||||
|
||||
# Make the entrypoint script executable
|
||||
RUN chmod +x /docker-entrypoint-initdb.d/init.sh
|
||||
|
|
@ -15,7 +15,8 @@ cd /app/dist
|
|||
case "$1" in
|
||||
"start")
|
||||
# Migrate the database and run
|
||||
/bin/bash /app/entrypoint.sh prisma migrate deploy && bun run ./index.js --prod
|
||||
/bin/bash /app/entrypoint.sh prisma migrate deploy
|
||||
NITRO_PORT=5173 bun run dist/frontend/server/index.mjs & NODE_ENV=production bun run dist/index.js --prod
|
||||
;;
|
||||
"cli")
|
||||
# Start the CLI
|
||||
|
|
|
|||
16
server.ts
16
server.ts
|
|
@ -173,22 +173,6 @@ export const createServer = (
|
|||
return errorResponse("Route not found", 404);
|
||||
}
|
||||
|
||||
// Proxy response from Vite at localhost:5173 if in development mode
|
||||
if (false) {
|
||||
let file = Bun.file("./pages/dist/index.html");
|
||||
if (new URL(req.url).pathname.startsWith("/assets")) {
|
||||
file = Bun.file(`./pages/dist${new URL(req.url).pathname}`);
|
||||
}
|
||||
|
||||
// Serve from pages/dist/assets
|
||||
if (await file.exists()) {
|
||||
return clientResponse(file, 200, {
|
||||
"Content-Type": file.type,
|
||||
});
|
||||
}
|
||||
return errorResponse("Asset not found", 404);
|
||||
}
|
||||
|
||||
const proxy = await fetch(
|
||||
req.url.replace(config.http.base_url, "http://localhost:5173"),
|
||||
).catch(async (e) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue