added docker support
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,15 +1,13 @@
|
|||||||
.env
|
.env
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
acecore
|
acecore*
|
||||||
*.exe
|
plugins/
|
||||||
|
build/web/
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
logs/
|
logs/
|
||||||
|
|
||||||
# Web
|
# Web
|
||||||
web/key.pem
|
web/key.pem
|
||||||
web/cert.pem
|
web/cert.pem
|
||||||
|
|
||||||
# Custom plugins
|
|
||||||
plugins/
|
|
@@ -1,8 +1,15 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
app_name = 'acecore'
|
||||||
|
|
||||||
src_dir = './plugin_src'
|
src_dir = './plugin_src'
|
||||||
output_dir = './plugins'
|
output_dir = './build'
|
||||||
|
|
||||||
|
subprocess.run('go build .', shell=True, check=True)
|
||||||
|
shutil.copy(app_name, output_dir)
|
||||||
|
print(f'Built main executable in {output_dir}/{app_name}')
|
||||||
|
|
||||||
if not os.path.exists(output_dir):
|
if not os.path.exists(output_dir):
|
||||||
os.makedirs(output_dir)
|
os.makedirs(output_dir)
|
||||||
@@ -10,6 +17,7 @@ if not os.path.exists(output_dir):
|
|||||||
for folder_name in os.listdir(src_dir):
|
for folder_name in os.listdir(src_dir):
|
||||||
folder_path = os.path.join(src_dir, folder_name)
|
folder_path = os.path.join(src_dir, folder_name)
|
||||||
if os.path.isdir(folder_path):
|
if os.path.isdir(folder_path):
|
||||||
command = f'go build -buildmode=plugin -o {output_dir}/{folder_name}.so {folder_path}'
|
command = f'go build -buildmode=plugin -o {output_dir}/plugins/{folder_name}.so {folder_path}'
|
||||||
subprocess.run(command, shell=True, check=True)
|
subprocess.run(command, shell=True, check=True)
|
||||||
print(f'Built plugin: {folder_name}.so')
|
print(f'Built plugin: {folder_name}.so')
|
||||||
|
|
7
build/.env.example
Normal file
7
build/.env.example
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
BOT_TOKEN=<token-here>
|
||||||
|
DB_USER=""
|
||||||
|
DB_PASSWORD=""
|
||||||
|
DB_SERVER=""
|
||||||
|
DB_PORT=""
|
||||||
|
DB_NAME=""
|
||||||
|
LOG_WEBHOOK=<url-here>
|
24
build/Dockerfile
Normal file
24
build/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
# Install necessary packages
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
postgresql-client \
|
||||||
|
ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the binary executable and other folders
|
||||||
|
COPY acecore /app/acecore
|
||||||
|
COPY plugins/ /app/plugins/
|
||||||
|
COPY web/ /app/web/
|
||||||
|
|
||||||
|
# Set executable permissions
|
||||||
|
RUN chmod +x /app/acecore
|
||||||
|
|
||||||
|
# Expose the port
|
||||||
|
EXPOSE 443
|
||||||
|
|
||||||
|
# Command to start the application
|
||||||
|
CMD ["/app/acecore"]
|
39
build/docker-compose.yaml
Normal file
39
build/docker-compose.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
version: '3.3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:13
|
||||||
|
container_name: acecore_db
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: acecore_prod
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
|
POSTGRES_DB: acecore_prod
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
container_name: acecore_app
|
||||||
|
environment:
|
||||||
|
BOT_TOKEN: ${BOT_TOKEN}
|
||||||
|
DB_USER: "acecore_prod"
|
||||||
|
DB_PASSWORD: ${DB_PASSWORD}
|
||||||
|
DB_SERVER: "db"
|
||||||
|
DB_PORT: 5432
|
||||||
|
DB_NAME: "acecore_prod"
|
||||||
|
LOG_WEBHOOK: ${LOG_WEBHOOK}
|
||||||
|
ports:
|
||||||
|
- "443:443"
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
- ./logs:/app/logs
|
||||||
|
- ./web:/app/web
|
||||||
|
- ./plugins:/app/plugins"
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db_data:
|
Reference in New Issue
Block a user