Skip to content

Commit c32b830

Browse files
committed
feat: Add Docker configuration and GitHub Actions deployment
- Add multi-stage Dockerfile for Astro build - Add docker-compose.yml for VPS deployment - Add .dockerignore to optimize build context - Add GitHub Actions workflow to build and push to GHCR - Image will be available at ghcr.io/getlumos/docs-lumos:latest
1 parent 6b293a3 commit c32b830

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed

.dockerignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
node_modules
2+
.git
3+
.gitignore
4+
.vscode
5+
.DS_Store
6+
*.md
7+
!README.md
8+
dist
9+
.astro
10+
.env
11+
.env.local
12+
.env.production
13+
npm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*

.github/workflows/deploy.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Push to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: getlumos/docs-lumos
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata for Docker
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+
tags: |
36+
type=raw,value=latest
37+
type=sha,prefix=sha-
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v5
41+
with:
42+
context: .
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}
46+
47+
- name: Image published
48+
run: |
49+
echo "Image pushed to ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
50+
echo "Pull command: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Stage 1: Build the Astro site
2+
FROM node:20-alpine AS builder
3+
4+
WORKDIR /app
5+
6+
# Copy package files
7+
COPY package*.json ./
8+
9+
# Install dependencies
10+
RUN npm ci
11+
12+
# Copy source files
13+
COPY . .
14+
15+
# Build the site
16+
RUN npm run build
17+
18+
# Stage 2: Serve with nginx
19+
FROM nginx:alpine
20+
21+
# Copy built files from builder stage
22+
COPY --from=builder /app/dist /usr/share/nginx/html
23+
24+
# Copy nginx configuration (if needed)
25+
# COPY nginx.conf /etc/nginx/nginx.conf
26+
27+
# Expose port 80
28+
EXPOSE 80
29+
30+
# Start nginx
31+
CMD ["nginx", "-g", "daemon off;"]

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: '3.8'
2+
3+
services:
4+
docs:
5+
image: ghcr.io/getlumos/docs-lumos:latest
6+
container_name: docs-lumos
7+
restart: unless-stopped
8+
ports:
9+
- "3001:80"
10+
environment:
11+
- NODE_ENV=production

0 commit comments

Comments
 (0)