mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
* Add Dockerfile with all in one docker image * Change to alpine image and reduce node_modules size * Improve documentation and fix changelog and license * Update changelog Co-authored-by: Valentin Zickner <ghostfolio@zickner.ch> Co-authored-by: Thomas <4159106+dtslvr@users.noreply.github.com>pull/445/head
Valentin Zickner
3 years ago
committed by
GitHub
8 changed files with 127 additions and 15 deletions
@ -0,0 +1,51 @@ |
|||||
|
FROM node:14-alpine as builder |
||||
|
|
||||
|
# Build application and add additional files |
||||
|
|
||||
|
WORKDIR /ghostfolio |
||||
|
|
||||
|
# Only add basic files without the application itself to avoid rebuilding |
||||
|
# layers when files (package.json etc.) have not changed |
||||
|
COPY ./CHANGELOG.md CHANGELOG.md |
||||
|
COPY ./LICENSE LICENSE |
||||
|
COPY ./package.json package.json |
||||
|
COPY ./yarn.lock yarn.lock |
||||
|
COPY ./prisma/schema.prisma prisma/schema.prisma |
||||
|
|
||||
|
RUN yarn |
||||
|
|
||||
|
# See https://github.com/nrwl/nx/issues/6586 for further details |
||||
|
COPY ./decorate-angular-cli.js decorate-angular-cli.js |
||||
|
RUN node decorate-angular-cli.js |
||||
|
|
||||
|
COPY ./angular.json angular.json |
||||
|
COPY ./nx.json nx.json |
||||
|
COPY ./replace.build.js replace.build.js |
||||
|
COPY ./jest.preset.js jest.preset.js |
||||
|
COPY ./jest.config.js jest.config.js |
||||
|
COPY ./tsconfig.base.json tsconfig.base.json |
||||
|
COPY ./libs libs |
||||
|
COPY ./apps apps |
||||
|
|
||||
|
RUN yarn build:all |
||||
|
|
||||
|
# Prepare the dist image with additional node_modules |
||||
|
WORKDIR /ghostfolio/dist/apps/api |
||||
|
# package.json was generated by the build process, however the original |
||||
|
# yarn.lock needs to be used to ensure the same versions |
||||
|
COPY ./yarn.lock /ghostfolio/dist/apps/api/yarn.lock |
||||
|
|
||||
|
RUN yarn |
||||
|
COPY prisma /ghostfolio/dist/apps/api/prisma |
||||
|
|
||||
|
# Overwrite the generated package.json with the original one to ensure having |
||||
|
# all the scripts |
||||
|
COPY package.json /ghostfolio/dist/apps/api |
||||
|
RUN yarn database:generate-typings |
||||
|
|
||||
|
# Image to run, copy everything needed from builder |
||||
|
FROM node:14-alpine |
||||
|
COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps |
||||
|
WORKDIR /ghostfolio/apps/api |
||||
|
EXPOSE 3333 |
||||
|
CMD [ "node", "main" ] |
@ -0,0 +1,24 @@ |
|||||
|
version: '3.7' |
||||
|
services: |
||||
|
postgres: |
||||
|
image: postgres:12 |
||||
|
env_file: |
||||
|
- ../.env |
||||
|
volumes: |
||||
|
- postgres:/var/lib/postgresql/data |
||||
|
|
||||
|
redis: |
||||
|
image: 'redis:alpine' |
||||
|
|
||||
|
ghostfolio: |
||||
|
build: ../ |
||||
|
env_file: |
||||
|
- ../.env |
||||
|
environment: |
||||
|
REDIS_HOST: 'redis' |
||||
|
DATABASE_URL: postgresql://user:password@postgres:5432/ghostfolio-db?sslmode=prefer |
||||
|
ports: |
||||
|
- 3333:3333 |
||||
|
|
||||
|
volumes: |
||||
|
postgres: |
@ -1,10 +1,10 @@ |
|||||
import { |
const { |
||||
AccountType, |
AccountType, |
||||
DataSource, |
DataSource, |
||||
PrismaClient, |
PrismaClient, |
||||
Role, |
Role, |
||||
Type |
Type |
||||
} from '@prisma/client'; |
} = require('@prisma/client'); |
||||
const prisma = new PrismaClient(); |
const prisma = new PrismaClient(); |
||||
|
|
||||
async function main() { |
async function main() { |
Loading…
Reference in new issue