From d15d23539e7e4d7fcdd3a6424ac96fb70151bb72 Mon Sep 17 00:00:00 2001 From: David Birks Date: Wed, 19 Aug 2020 00:23:04 -0400 Subject: [PATCH] Add Dockerfile and docker-compose.yml --- Dockerfile | 12 ++++++++++++ README.md | 10 +++++++++- docker-compose.yml | 25 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..7a44cb28 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:12.18-alpine + +COPY . /app +WORKDIR /app + +RUN npm install \ + && npm run build-postgresql-client \ + && npm run build + +EXPOSE 3000 + +CMD ["npm", "start"] diff --git a/README.md b/README.md index 3d08a1fd..dd9e65ed 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # umami -## Installation +## Installation from source ### Get the source code @@ -87,6 +87,14 @@ By default this will launch the application on `http://localhost:3000`. You will [proxy](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) requests from your web server or change the [port](https://nextjs.org/docs/api-reference/cli#production) to serve the application directly. +## Installation with Docker + +To build the umami container and start up a Postgres database, run: + +``` +docker-compose up +``` + ## License MIT \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..b09b81eb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.8' +services: + umami: + build: . + ports: + - "3000:3000" + environment: + DATABASE_URL: postgresql://umami:umami@postgres:5432/umami + HASH_SALT: replace-me-with-a-random-string + postgres: + image: postgres:alpine + ports: + - "5432:5432" + environment: + POSTGRES_USER: umami + POSTGRES_PASSWORD: umami + volumes: + - type: bind + source: ./sql/schema.postgresql.sql + target: /docker-entrypoint-initdb.d/schema.postgresql.sql + - type: volume + source: postgres-data + target: /var/lib/postgresql/data +volumes: + postgres-data: