fixing docker and deployment

This commit is contained in:
ngn 2023-11-12 18:18:01 +03:00
parent 462c49f61d
commit 63c2ff2d76
4 changed files with 13 additions and 9 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
api/server *.yaml
api/data.db *.env

View File

@ -31,8 +31,9 @@ by running `admin_script`.
## Deployment ## Deployment
Easiest way to deploy is to use docker. I have created a `compose.yaml` file so the API and the 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 ```yaml
version: "3"
services: services:
app: app:
build: ./app build: ./app
@ -40,8 +41,7 @@ services:
- "127.0.0.1:7002:7002" - "127.0.0.1:7002:7002"
depends_on: depends_on:
- api - api
enviroment: env_file: all.env
- VITE_API_URL_DEV="https://api.ngn.tf"
api: api:
build: ./api build: ./api
@ -49,8 +49,12 @@ services:
- "127.0.0.1:7001:7001" - "127.0.0.1:7001:7001"
volumes: volumes:
- ./api/api.db:/api.db - ./api/api.db:/api.db
enviroment: env_file: all.env
- PASS=securepassword ```
Enviroment variables can be set in the `all.env` file:
```env
PASS=securepassword
VITE_API_URL_DEV="https://api.ngn.tf"
``` ```
## History ## History

2
api/.gitignore vendored
View File

@ -1,2 +1,2 @@
server server
api.db *.db

View File

@ -4,7 +4,7 @@ RUN apk update && apk upgrade && adduser -D svelte
USER svelte USER svelte
WORKDIR /app WORKDIR /app
COPY --chown=svelteuser:svelte . /app COPY --chown=svelte:svelte . /app
RUN npm install && npm run build RUN npm install && npm run build
CMD ["npm", "run", "preview"] CMD ["npm", "run", "preview"]