Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker Build and Push

on:
push:
branches:
- main

env:
IMAGE_NAME: polaris-bot

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v4

# Log in to GitHub Container Registry
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}

# Build and push the Docker image
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use Node.js LTS with full build tools
FROM node:18-bullseye

# Set working directory
WORKDIR /app

# Install Python and build dependencies
RUN apt-get update && \
apt-get install -y python3 make g++ && \
rm -rf /var/lib/apt/lists/*

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy all source files
COPY . .

# Expose web server port
EXPOSE 6880

# Start the bot
CMD ["node", "polaris.js"]
34 changes: 34 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.8'
services:
polaris:
image: ghcr.io/gdcolon/polaris-bot:main
container_name: polaris-bot
restart: unless-stopped
ports:
- "6880:6880"
volumes:
- ./config.json:/app/config.json
- ./.env:/app/.env
environment:
- NODE_ENV=production
depends_on:
- mongo
networks:
- polaris-net

mongo:
image: mongo:6
container_name: polaris-mongo
restart: unless-stopped
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USER}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASS}
- MONGO_INITDB_DATABASE=${MONGO_DB}
volumes:
- ./mongo_data:/data/db
networks:
- polaris-net

networks:
polaris-net:
driver: bridge