diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..45595fbdc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM node:14 as builder + +WORKDIR /app + +COPY ./package.json package.json +COPY ./yarn.lock yarn.lock +COPY ./prisma/schema.prisma prisma/schema.prisma + +RUN yarn + +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 + +COPY ./prisma/seed.ts prisma/seed.ts + +FROM node:14 +COPY --from=builder /app/dist/apps /app/apps +COPY --from=builder /app/package.json /app/package.json +# todo: change build to ensure that node_modules folder isn't required to reduce image size +COPY --from=builder /app/node_modules /app/node_modules +COPY --from=builder /app/prisma /app/prisma +WORKDIR /app +EXPOSE 3333 +CMD [ "npm", "run", "start:prod" ] diff --git a/README.md b/README.md index 78b0e2cf0..64b91bc3d 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,36 @@ The backend is based on [NestJS](https://nestjs.com) using [PostgreSQL](https:// The frontend is built with [Angular](https://angular.io) and uses [Angular Material](https://material.angular.io) with utility classes from [Bootstrap](https://getbootstrap.com). -## Getting Started +## Run with Docker + +### Prerequisites + +- [Docker](https://www.docker.com/products/docker-desktop) + +### Setup + +To run it with docker you can simply execute: + +```bash +docker-compose -f docker/docker-compose-all.yml build +docker-compose -f docker/docker-compose-all.yml up +``` + +This will build a docker image of ghostfolio locally on your machine and start it up, including dependencies and the database. + +To initialize the database, you can run the following command once ghostfolio is started: +```bash +docker-compose -f docker/docker-compose-all.yml exec ghostfolio yarn setup:database +``` + +After this, go to http://localhost:3333/ and follow those steps: + +1. Login as _Admin_ with the following _Security Token_: `ae76872ae8f3419c6d6f64bf51888ecbcc703927a342d815fafe486acdb938da07d0cf44fca211a0be74a423238f535362d390a41e81e633a9ce668a6e31cdf9` +1. Go to the _Admin Control Panel_ and click _Gather All Data_ to fetch historical data +1. Click _Sign out_ and check out the _Live Demo_ + + +## Development ### Prerequisites @@ -101,10 +130,6 @@ The frontend is built with [Angular](https://angular.io) and uses [Angular Mater 1. Go to the _Admin Control Panel_ and click _Gather All Data_ to fetch historical data 1. Click _Sign out_ and check out the _Live Demo_ -## Development - -Please make sure you have completed the instructions from [_Setup_](#Setup). - ### Start server