messing up deployment

This commit is contained in:
echo 2026-02-24 13:49:03 +01:00
parent a9528582fd
commit 831da0af4d
2 changed files with 12 additions and 33 deletions

View File

@ -36,9 +36,12 @@ COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=nodejs:nodejs /app/package*.json ./
COPY --from=builder --chown=nodejs:nodejs /app/dist/config ./config
# Create data directory
RUN mkdir -p /app/.tmp && \
chown -R nodejs:nodejs /app/.tmp
# Also copy .env file if exists (for defaults)
COPY --from=builder --chown=nodejs:nodejs /app/.env ./
# Create data and database directories with proper permissions
RUN mkdir -p /app/.tmp /app/database /app/uploads /app/database/migrations && \
chown -R nodejs:nodejs /app
# Switch to non-root user
USER nodejs

View File

@ -3,19 +3,12 @@ import path from 'path';
export default ({ env }) => {
const client = env('DATABASE_CLIENT', 'sqlite');
if (client === 'postgres') {
const connectionString = env('DATABASE_URL');
if (connectionString) {
return {
connection: {
client,
connection: connectionString,
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
};
}
console.log('DATABASE_CLIENT:', client);
console.log('DATABASE_HOST:', env('DATABASE_HOST', 'not-set'));
console.log('DATABASE_USERNAME:', env('DATABASE_USERNAME', 'not-set'));
console.log('DATABASE_NAME:', env('DATABASE_NAME', 'not-set'));
if (client === 'postgres') {
return {
connection: {
client,
@ -27,24 +20,7 @@ export default ({ env }) => {
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false),
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
},
};
}
if (client === 'mysql') {
return {
connection: {
client,
connection: {
host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 3306),
database: env('DATABASE_NAME', 'strapi'),
user: env('DATABASE_USERNAME', 'strapi'),
password: env('DATABASE_PASSWORD', 'strapi'),
ssl: env.bool('DATABASE_SSL', false),
},
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
pool: { min: 2, max: 10 },
},
};
}