mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
feat: better docker builds
This commit is contained in:
@ -8,6 +8,7 @@ dist
|
||||
|
||||
# Node dependencies
|
||||
node_modules
|
||||
.yarn
|
||||
|
||||
# Logs
|
||||
logs
|
||||
@ -23,4 +24,8 @@ logs
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
.data
|
||||
# deploy template
|
||||
deploy-template/
|
||||
|
||||
# generated prisma client
|
||||
/prisma/client
|
||||
|
||||
42
Dockerfile
42
Dockerfile
@ -1,30 +1,40 @@
|
||||
# pull pre-configured and updated build environment
|
||||
FROM debian:testing-20250317-slim AS build-system
|
||||
# Unified deps builder
|
||||
FROM node:lts-alpine AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn install --network-timeout 1000000 --ignore-scripts
|
||||
|
||||
# Build for app
|
||||
FROM node:lts-alpine AS build-system
|
||||
# setup workdir - has to be the same filepath as app because fuckin' Prisma
|
||||
WORKDIR /app
|
||||
|
||||
# install dependencies and build
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install node-corepack -y
|
||||
RUN corepack enable
|
||||
ENV NODE_ENV=production
|
||||
ENV NUXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# copy deps and rest of project files
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN NUXT_TELEMETRY_DISABLED=1 yarn install --network-timeout 1000000
|
||||
RUN NUXT_TELEMETRY_DISABLED=1 yarn prisma generate
|
||||
RUN NUXT_TELEMETRY_DISABLED=1 yarn build
|
||||
|
||||
# build
|
||||
RUN yarn postinstall
|
||||
RUN yarn build
|
||||
|
||||
# create run environment for Drop
|
||||
FROM node:lts-slim AS run-system
|
||||
|
||||
FROM node:lts-alpine AS run-system
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NUXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN yarn add --network-timeout 1000000 --no-lockfile prisma@6.7.0
|
||||
|
||||
COPY --from=build-system /app/package.json ./
|
||||
COPY --from=build-system /app/.output ./app
|
||||
COPY --from=build-system /app/prisma ./prisma
|
||||
COPY --from=build-system /app/package.json ./
|
||||
COPY --from=build-system /app/build ./startup
|
||||
|
||||
# OpenSSL as a dependency for Drop (TODO: seperate build environment)
|
||||
RUN apt-get update -y && apt-get install -y openssl
|
||||
RUN yarn global add prisma@6.7.0
|
||||
ENV LIBRARY="/library"
|
||||
ENV DATA="/data"
|
||||
|
||||
CMD ["/app/startup/launch.sh"]
|
||||
CMD ["sh", "/app/startup/launch.sh"]
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
|
||||
# This file starts up the Drop server by running migrations and then starting the executable
|
||||
echo "[Drop] performing migrations..."
|
||||
ls ./prisma/migrations/
|
||||
prisma migrate deploy
|
||||
yarn prisma migrate deploy
|
||||
|
||||
# Actually start the application
|
||||
node /app/app/server/index.mjs
|
||||
node /app/app/server/index.mjs
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14-alpine
|
||||
# using alpine image to reduce image size
|
||||
image: postgres:alpine
|
||||
ports:
|
||||
- 5432:5432
|
||||
healthcheck:
|
||||
@ -16,7 +17,7 @@ services:
|
||||
- POSTGRES_USER=drop
|
||||
- POSTGRES_DB=drop
|
||||
drop:
|
||||
image: registry.deepcore.dev/drop-oss/drop/main:latest
|
||||
image: ghcr.io/drop-oss/drop
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
@ -24,11 +25,6 @@ services:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- ./library:/library
|
||||
- ./certs:/certs
|
||||
- ./objects:/objects
|
||||
- ./data:/data
|
||||
environment:
|
||||
- DATABASE_URL=postgres://drop:drop@postgres:5432/drop
|
||||
- FS_BACKEND_PATH=/objects
|
||||
- CLIENT_CERTIFICATES=/certs
|
||||
- LIBRARY=/library
|
||||
- GIANT_BOMB_API_KEY=REPLACE_WITH_YOUR_KEY
|
||||
|
||||
Reference in New Issue
Block a user