docker based deployment

This commit is contained in:
DecDuck
2024-11-04 20:50:35 +11:00
parent 5fe2036f0b
commit c5d00b4766
7 changed files with 95 additions and 17 deletions

26
.dockerignore Normal file
View File

@ -0,0 +1,26 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example
.data

7
.gitignore vendored
View File

@ -23,5 +23,10 @@ logs
.env.*
!.env.example
.data
# deploy template
deploy-template/*
!deploy-template/compose.yml

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
# pull pre-configured and updated build environment
FROM registry.deepcore.dev/drop-oss/drop-server-build-environment/main:latest AS build-system
# setup workdir
RUN mkdir /build
WORKDIR /build
# install dependencies and build
COPY . .
RUN yarn install
RUN yarn build
# create run environment for Drop
FROM node:lts-slim AS run-system
RUN mkdir /app
WORKDIR /app
COPY --from=build-system /build/.output ./app
COPY --from=build-system /build/prisma ./prisma
COPY --from=build-system /build/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
CMD ["/app/startup/launch.sh"]

7
build/launch.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# This file starts up the Drop server by running migrations and then starting the executable
prisma migrate deploy
# Actually start the application
node /app/app/server/index.mjs

View File

@ -0,0 +1,27 @@
services:
postgres:
image: postgres:14-alpine
user: "1000:1000"
ports:
- 5432:5432
volumes:
- ./db:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=drop
- POSTGRES_USER=drop
- POSTGRES_DB=drop
drop:
image: drop # todo
user: "1000:1000"
ports:
- 3000:3000
volumes:
- ./library:/library
- ./certs:/certs
- ./objects:/objects
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

View File

@ -9,16 +9,4 @@ services:
environment:
- POSTGRES_PASSWORD=drop
- POSTGRES_USER=drop
- POSTGRES_DB=drop
minio:
# honestly no idea where this image comes from
image: quay.io/minio/minio
ports:
- 9000:9000
- 9001:9001
volumes:
- ../.data/s3:/data
environment:
- MINIO_ROOT_USER=drop
- MINIO_ROOT_PASSWORD=drop
command: server /data --console-address ":9001"
- POSTGRES_DB=drop

View File

@ -1,6 +1,4 @@
import {
applicationSettings,
} from "../internal/config/application-configuration";
import { applicationSettings } from "../internal/config/application-configuration";
import prisma from "../internal/db/database";
export default defineNitroPlugin(async (nitro) => {