add CI
parent
82e6c76d88
commit
26956763b8
@ -0,0 +1,15 @@
|
||||
FROM node:16-alpine as builder
|
||||
|
||||
WORKDIR /app
|
||||
ADD . .
|
||||
|
||||
RUN npm ci && npm run build
|
||||
|
||||
|
||||
# build nginx webserver
|
||||
FROM nginx:alpine
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ADD ./nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=builder /app/dist /var/www/html
|
@ -0,0 +1,20 @@
|
||||
version: '3'
|
||||
|
||||
networks:
|
||||
web:
|
||||
external: true
|
||||
|
||||
services:
|
||||
frontend:
|
||||
image: docker.cybre.town/adb/cybre-town
|
||||
restart: always
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
|
||||
- "traefik.http.routers.cybre-town.rule=Host(`cybre.town`)"
|
||||
- "traefik.http.routers.cybre-town.entrypoints=https"
|
||||
- "traefik.http.services.cybre-town.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.cybre-town.tls.certresolver=mytlschallenge"
|
||||
- "traefik.docker.network=web"
|
||||
networks:
|
||||
- web
|
@ -0,0 +1,41 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: docker.cybre.town
|
||||
repo: docker.cybre.town/adb/cybre-town
|
||||
tags:
|
||||
- "${DRONE_COMMIT_SHA:0:8}"
|
||||
- "latest"
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: deploy
|
||||
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
steps:
|
||||
- name: pull and deploy
|
||||
image: appleboy/drone-ssh:linux-amd64
|
||||
settings:
|
||||
host:
|
||||
from_secret: ssh_host
|
||||
username:
|
||||
from_secret: ssh_user_name
|
||||
key:
|
||||
from_secret: ssh_private_key
|
||||
script: |
|
||||
cd /media/docker/cybre.town
|
||||
docker compose -f docker-compose.prod.yml -p cybre-town pull -q
|
||||
docker compose -f docker-compose.prod.yml -p cybre-town up -d
|
@ -0,0 +1,36 @@
|
||||
worker_processes auto;
|
||||
worker_cpu_affinity auto;
|
||||
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
#daemon off;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
# rewrite_log on;
|
||||
include mime.types;
|
||||
default_type application/json;
|
||||
access_log /var/log/nginx/access.log;
|
||||
sendfile on;
|
||||
# tcp_nopush on;
|
||||
keepalive_timeout 3;
|
||||
# tcp_nodelay on;
|
||||
gzip on;
|
||||
client_max_body_size 1m;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
absolute_redirect off;
|
||||
|
||||
location / {
|
||||
charset utf-8;
|
||||
index index.html;
|
||||
root /var/www/html;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue