Skip to content

Commit

Permalink
feat: add docker for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
NuttyShrimp committed Apr 20, 2024
1 parent 6e450da commit f18916e
Show file tree
Hide file tree
Showing 9 changed files with 9,614 additions and 11,557 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.git
.gitignore
*.md
dist
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:20-alpine AS base

WORKDIR /src

COPY --link package.json yarn.lock .
RUN yarn install --frozen-lockfile

COPY . .

RUN yarn prisma generate

RUN yarn run build

# RUN yarn prisma generate --generator docker

ENV NODE_ENV=production

CMD [ "yarn", "start"]
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
snaphold:
build:
context: .
tags:
- snaphold:latest
depends_on:
- db
ports:
- 3000:3000
environment:
DATABASE_URL: "postgresql://snaphold:password@db:5432/snaphold?schema=public&sslmode=prefer"

db:
image: postgres:16
restart: always
environment:
POSTGRES_PASSWORD: password
POSTGRES_USER: snaphold
POSTGRES_DB: snaphold
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
in
with pkgs; {
devShells.default = pkgs.devshell.mkShell {
packages = [ nodejs nodePackages.pnpm nodePackages.prisma postgresql_16 redis ];
packages = [ nodejs nodePackages.pnpm nodePackages.yarn postgresql_16 redis ];
commands = [
{
name = "pg:setup";
Expand Down
5 changes: 5 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ export default defineNuxtConfig({
title: "SnapHold - 12urenloop"
},
},
// nitro: {
// externals: {
// traceInclude: ["node_modules/@prisma/client"]
// },
// },
runtimeConfig: {
googleClientId: process.env.GOOGLE_CLIENT_ID,
googleClientSecret: process.env.GOOGLE_CLIENT_SECRET,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"private": true,
"type": "module",
"scripts": {
"start": "prisma migrate deploy && node .output/server/index.mjs",
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare && prisma generate",
"postinstall": "prisma generate && nuxt prepare",
"preview:build": "pnpm build && node .output/server/index.mjs"
},
"dependencies": {
Expand Down
Loading

0 comments on commit f18916e

Please sign in to comment.