From 63c2ff2d76d2a6cf01e4e7debde4c91aa82f3e21 Mon Sep 17 00:00:00 2001 From: ngn Date: Sun, 12 Nov 2023 18:18:01 +0300 Subject: [PATCH] fixing docker and deployment --- .gitignore | 4 ++-- README.md | 14 +++++++++----- api/.gitignore | 2 +- app/Dockerfile | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 7933ff9..6c4cd8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -api/server -api/data.db +*.yaml +*.env diff --git a/README.md b/README.md index 4d450ed..91cdbf9 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,9 @@ by running `admin_script`. ## Deployment Easiest way to deploy is to use docker. I have created a `compose.yaml` file so the API and the -frontend application can be deployed easily with just the `docker compose up` command: +frontend application can be deployed easily with just the `docker-compose up` command: ```yaml +version: "3" services: app: build: ./app @@ -40,8 +41,7 @@ services: - "127.0.0.1:7002:7002" depends_on: - api - enviroment: - - VITE_API_URL_DEV="https://api.ngn.tf" + env_file: all.env api: build: ./api @@ -49,8 +49,12 @@ services: - "127.0.0.1:7001:7001" volumes: - ./api/api.db:/api.db - enviroment: - - PASS=securepassword + env_file: all.env +``` +Enviroment variables can be set in the `all.env` file: +```env +PASS=securepassword +VITE_API_URL_DEV="https://api.ngn.tf" ``` ## History diff --git a/api/.gitignore b/api/.gitignore index 6272dcf..2d6f3a5 100644 --- a/api/.gitignore +++ b/api/.gitignore @@ -1,2 +1,2 @@ server -api.db +*.db diff --git a/app/Dockerfile b/app/Dockerfile index aa5b0a0..250ea1b 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -4,7 +4,7 @@ RUN apk update && apk upgrade && adduser -D svelte USER svelte WORKDIR /app -COPY --chown=svelteuser:svelte . /app +COPY --chown=svelte:svelte . /app RUN npm install && npm run build CMD ["npm", "run", "preview"]