Added deploy for Docs
This commit is contained in:
38
.github/workflows/deploy_docs.yml
vendored
Normal file
38
.github/workflows/deploy_docs.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Ascently - Docs Deploy
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths: ["docs/**"]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths: ["docs/**"]
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.REPO_HOST }}
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.DEPLOY_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./docs
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/ascently-docs:${{ github.sha }}
|
||||
${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/ascently-docs:latest
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Ascently Docker Deploy
|
||||
name: Ascently - Sync Deploy
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
password: ${{ secrets.DEPLOY_TOKEN }}
|
||||
|
||||
- name: Build and push sync-server
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./sync
|
||||
file: ./sync/Dockerfile
|
||||
79
docs/.dockerignore
Normal file
79
docs/.dockerignore
Normal file
@@ -0,0 +1,79 @@
|
||||
# Node modules
|
||||
node_modules
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# Build output
|
||||
dist
|
||||
.astro
|
||||
|
||||
# IDE files
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Docker
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
.dockerignore
|
||||
|
||||
# Documentation
|
||||
README.md
|
||||
*.md
|
||||
|
||||
# Cache directories
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Dependency directories
|
||||
jspm_packages/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# Temporary folders
|
||||
tmp/
|
||||
temp/
|
||||
4
docs/.vscode/extensions.json
vendored
4
docs/.vscode/extensions.json
vendored
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"recommendations": ["astro-build.astro-vscode"],
|
||||
"unwantedRecommendations": []
|
||||
}
|
||||
11
docs/.vscode/launch.json
vendored
11
docs/.vscode/launch.json
vendored
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"command": "./node_modules/.bin/astro dev",
|
||||
"name": "Development server",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
78
docs/Dockerfile
Normal file
78
docs/Dockerfile
Normal file
@@ -0,0 +1,78 @@
|
||||
FROM node:24-alpine AS base
|
||||
|
||||
# Install system dependencies
|
||||
RUN apk add --no-cache \
|
||||
python3 \
|
||||
make \
|
||||
g++ \
|
||||
libc6-compat \
|
||||
vips-dev \
|
||||
curl
|
||||
|
||||
# Install pnpm globally
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# Configure pnpm
|
||||
RUN pnpm config set store-dir /.pnpm-store
|
||||
RUN pnpm config set network-timeout 300000
|
||||
RUN pnpm config set fetch-retries 10
|
||||
RUN pnpm config set fetch-retry-factor 2
|
||||
|
||||
FROM base AS deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Install dependencies with retry logic
|
||||
RUN --mount=type=cache,id=pnpm,target=/.pnpm-store \
|
||||
pnpm install --frozen-lockfile || \
|
||||
(sleep 5 && pnpm install --frozen-lockfile) || \
|
||||
(sleep 10 && pnpm install --frozen-lockfile --no-frozen-lockfile)
|
||||
|
||||
FROM base AS build-deps
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Install all dependencies including dev dependencies
|
||||
RUN --mount=type=cache,id=pnpm,target=/.pnpm-store \
|
||||
pnpm install --frozen-lockfile || \
|
||||
(sleep 5 && pnpm install --frozen-lockfile) || \
|
||||
(sleep 10 && pnpm install --frozen-lockfile --no-frozen-lockfile)
|
||||
|
||||
FROM build-deps AS builder
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN pnpm run build
|
||||
|
||||
FROM node:20-alpine AS runtime
|
||||
|
||||
# Install pnpm for runtime
|
||||
RUN npm install -g pnpm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy built application
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# Copy production dependencies and package files
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Set environment variables
|
||||
ENV HOST=0.0.0.0 \
|
||||
PORT=4321 \
|
||||
NODE_ENV=production
|
||||
|
||||
# Expose port
|
||||
EXPOSE 4321
|
||||
|
||||
# Start the application using Astro preview
|
||||
CMD ["pnpm", "run", "preview", "--host", "0.0.0.0"]
|
||||
8
docs/docker-compose.yml
Normal file
8
docs/docker-compose.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
services:
|
||||
app:
|
||||
image: ${IMAGE}
|
||||
ports:
|
||||
- "${APP_PORT}:4321"
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
restart: unless-stopped
|
||||
3
docs/pnpm-workspace.yaml
Normal file
3
docs/pnpm-workspace.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
onlyBuiltDependencies:
|
||||
- esbuild
|
||||
- sharp
|
||||
Reference in New Issue
Block a user