Add Docker deployment and improved documentation.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/aea157e5-907c-4910-b5b7-c0994e1daea0.jpg
This commit is contained in:
alphaeusmote
2025-04-11 18:33:15 +00:00
5 changed files with 94 additions and 0 deletions
+1
View File
@@ -10,6 +10,7 @@ REDIS_URL=redis://redis:6379
# Application Configuration
NODE_ENV=production
PORT=5000
BASE_URL=http://localhost:5000
SESSION_SECRET=change_this_to_a_random_string
DEBUG=api:*
+69
View File
@@ -0,0 +1,69 @@
name: Docker
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is needed for token authentication
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
+1
View File
@@ -24,6 +24,7 @@ WORKDIR /app
# Set environment variables
ENV NODE_ENV=production
ENV PORT=5000
ENV BASE_URL=http://localhost:5000
# Authentication environment variables
ENV JWT_SECRET=change-this-in-production
+22
View File
@@ -150,6 +150,7 @@ The application follows a modern web architecture with clear separation of conce
```bash
# Make sure to set appropriate values in your .env file
# For production deployments, ensure secure values for SESSION_SECRET and other security settings
# Don't forget to set BASE_URL to your server's public URL
```
4. Start the application stack:
@@ -162,6 +163,26 @@ The application follows a modern web architecture with clear separation of conce
- API: https://your-server-domain/api
- Swagger Documentation: https://your-server-domain/api/docs
#### Using Docker Hub Image
The application is also available as a pre-built Docker image:
1. Pull the image from Docker Hub:
```bash
docker pull yourusername/ad-management-platform:latest
```
2. Create a .env file with your configuration.
3. Run the container with your environment variables:
```bash
docker run -d \
--name ad-management \
-p 5000:5000 \
--env-file .env \
yourusername/ad-management-platform:latest
```
#### Manual Deployment
For manual deployment instructions, refer to the [Deployment Guide](DEPLOYMENT.md).
@@ -198,6 +219,7 @@ Configuration is managed through environment variables. See [.env.example](.env.
- **Database**: PostgreSQL connection settings
- **Redis**: Caching configuration
- **Application**: Base URL and port configuration
- **Session**: Security settings for user sessions
- **JWT**: Settings for API tokens
- **LDAP**: Connection parameters for Active Directory
+1
View File
@@ -10,6 +10,7 @@ services:
environment:
- NODE_ENV=production
- PORT=5000
- BASE_URL=${BASE_URL:-http://localhost:5000}
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379
- SESSION_SECRET=${SESSION_SECRET}