Browse Source

add Dockerfile with all in one docker image

pull/431/head
Valentin Zickner 4 years ago
committed by Thomas
parent
commit
9d2e844721
  1. 35
      Dockerfile
  2. 35
      README.md
  3. 24
      docker/docker-compose-all.yml

35
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" ]

35
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). 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 ### 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. 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_ 1. Click _Sign out_ and check out the _Live Demo_
## Development
Please make sure you have completed the instructions from [_Setup_](#Setup).
### Start server ### Start server
<ol type="a"> <ol type="a">

24
docker/docker-compose-all.yml

@ -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:
Loading…
Cancel
Save