Настроил сборку drone
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Struchkov Mark 2023-05-28 18:33:13 +03:00
parent 655973a961
commit 18d2de7805
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
3 changed files with 64 additions and 64 deletions

48
.drone.yml Normal file
View File

@ -0,0 +1,48 @@
---
kind: pipeline
type: docker
name: build
steps:
- name: build and push noteshare
image: upagge/docker-buildx:latest
environment:
DOCKER_REGISTRY_TOKEN:
from_secret: DOCKER_REGISTRY_TOKEN
volumes:
- name: dockersock
path: /var/run
commands:
- sleep 10
- echo "$DOCKER_REGISTRY_TOKEN" | docker login docker.io --username upagge --password-stdin
- docker build -f server/prisma/Dockerfile -t upagge/noteshare-migrations:latest .
- docker build -f server/Dockerfile -t upagge/noteshare-backend:latest .
- docker build -f webapp/Dockerfile -t upagge/noteshare-frontend:latest .
- docker push upagge/noteshare-migrations:latest
- docker push upagge/noteshare-backend:latest
- docker push upagge/noteshare-frontend:latest
trigger:
branch:
- drone
services:
- name: docker
image: docker:20.10.22-dind-alpine3.17
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
- name: node_modules
host:
path: /drone/volume/node_modules/mkdocs-material
---
kind: signature
hmac: 0ec99b7f17c1137635b751c291f37d72cec97ba2caa5736ba313d9e1fb86108d
...

View File

@ -1,39 +1,22 @@
version: "3.7"
services:
# Reverse proxy
traefik:
image: "traefik:v2.8"
command:
- "--api.insecure=true" # allows accessing a Traefik dashboard, disable in production
- "--providers.docker=true" # enables the Docker configuration discovery
- "--providers.docker.exposedbydefault=false" # do not expose Docker services by default
- "--entrypoints.web.address=:5000" # create an entrypoint called web, listening on :5000
- "--entrypoints.admin.address=:3333" # create an entrypoint called web, listening on :5000
ports:
- "5000:5000"
- "3333:3333"
- "8765:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
# Prisma sqlite migration utility
migrate:
build:
context: ./server/prisma
dockerfile: Dockerfile
noteshare-migrate:
image: upagge/noteshare-migrations:latest
volumes:
- sqlite:/database/
- ./noteshare/database:/database/
environment:
- DATABASE_URL=file:/database/db.sqlite
# Backend server for managing saved notes
backend:
build:
context: ./server
dockerfile: Dockerfile
noteshare-backend:
image: upagge/noteshare-backend:latest
restart: always
hostname: noteshare-backend
container_name: noteshare-backend
volumes:
- sqlite:/database/
- ./noteshare/database:/database/
environment:
- DATABASE_URL=file:/database/db.sqlite
- FRONTEND_URL=http://localhost:5000
@ -48,45 +31,14 @@ services:
depends_on:
migrate:
condition: service_completed_successfully
restart: unless-stopped
labels:
- "traefik.enable=true" # tell Traefik this is something we would like to expose
- "traefik.http.routers.backend.entrypoints=web" # what entrypoint should be used for the backend service.
- "traefik.http.routers.backend.rule=Host(`localhost`) && PathPrefix(`/api`) && (Method(`POST`) || Method(`DELETE`))" #
# Frontend for serving encrypted notes over HTML (SvelteKit)
frontend:
build:
context: ./webapp
dockerfile: Dockerfile
args:
- VITE_SERVER_INTERNAL=http://backend:8080
- VITE_BRANDING=Noteshare.space [preview]
image: upagge/noteshare-backend:latest
restart: always
hostname: noteshare-backend
container_name: noteshare-backend
environment:
- NODE_ENV=production
depends_on:
- backend
restart: unless-stopped
labels:
- "traefik.enable=true" # tell Traefik this is something we would like to expose
- "traefik.http.routers.frontend.entrypoints=web" # what entrypoint should be used for the frontend service.
- "traefik.http.routers.frontend.rule=Host(`localhost`)" #
# grafana dashboard
grafana:
image: grafana/grafana:9.1.0
restart: unless-stopped
volumes:
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- grafana-data:/var/lib/grafana
- sqlite:/database/
environment:
- GF_INSTALL_PLUGINS=frser-sqlite-datasource
labels:
- "traefik.enable=true" # tell Traefik this is something we would like to expose
- "traefik.http.routers.grafana.entrypoints=admin" # what entrypoint should be used for the frontend service.
- "traefik.http.routers.grafana.rule=Host(`localhost`)" #
volumes:
sqlite:
grafana-data:
- noteshare-backend

View File

@ -1,7 +1,7 @@
FROM node:16-alpine AS BUILD_IMAGE
ARG VITE_SERVER_INTERNAL $VITE_SERVER_INTERNAL
ARG VITE_BRANDING $VITE_BRANDING
ARG VITE_SERVER_INTERNAL=http://noteshare-backend:8080
ARG VITE_BRANDING=Struchkov.Note
# install dependencies
WORKDIR /app