Update README with Docker deployment instructions and bump version to 0.0.1-beta in package.json
This commit is contained in:
19
.dockerignore
Normal file
19
.dockerignore
Normal file
@@ -0,0 +1,19 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
.git
|
||||
.gitignore
|
||||
README.md
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
dist
|
||||
.DS_Store
|
||||
*.log
|
||||
.vscode
|
||||
.idea
|
||||
Screen Shots
|
||||
BOM.xlsx
|
||||
~$BOM.xlsx
|
||||
custom-covers
|
||||
95
.github/workflows/docker-publish.yml
vendored
Normal file
95
.github/workflows/docker-publish.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
name: Build and Publish Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version tag (e.g., V0.0.1-BETA)'
|
||||
required: true
|
||||
default: 'V0.0.1-BETA'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Determine version tag
|
||||
id: version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||
echo "tag=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
echo "create_release=true" >> $GITHUB_OUTPUT
|
||||
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
echo "create_release=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||
echo "create_release=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=${{ steps.version.outputs.tag }}
|
||||
type=raw,value=latest,enable=${{ steps.version.outputs.tag == 'latest' }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Create Release
|
||||
if: steps.version.outputs.create_release == 'true'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.version.outputs.tag }}
|
||||
name: Release ${{ steps.version.outputs.tag }}
|
||||
body: |
|
||||
## Release ${{ steps.version.outputs.tag }}
|
||||
|
||||
Docker image is available at:
|
||||
- `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}`
|
||||
|
||||
### Running the Docker image
|
||||
|
||||
```bash
|
||||
docker run -d -p 80:80 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.tag }}
|
||||
```
|
||||
|
||||
The application will be available at http://localhost:80
|
||||
prerelease: true
|
||||
draft: false
|
||||
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
# Build stage
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY website/package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Copy source code
|
||||
COPY website/ ./
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy built files from builder stage
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Copy nginx configuration for SPA routing
|
||||
RUN echo 'server { \
|
||||
listen 80; \
|
||||
server_name _; \
|
||||
root /usr/share/nginx/html; \
|
||||
index index.html; \
|
||||
location / { \
|
||||
try_files $uri $uri/ /index.html; \
|
||||
} \
|
||||
}' > /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
61
README.md
61
README.md
@@ -47,6 +47,11 @@ The OSSM Configurator is a React-based single-page application built with Vite.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
**Option 1: Using Docker (Recommended)**
|
||||
- Docker Desktop or Docker Engine
|
||||
- Docker Compose
|
||||
|
||||
**Option 2: Local Development**
|
||||
- Node.js (v16 or higher recommended)
|
||||
- npm or yarn
|
||||
|
||||
@@ -90,6 +95,62 @@ Preview the production build locally:
|
||||
npm run preview
|
||||
```
|
||||
|
||||
## Docker Deployment
|
||||
|
||||
### Development with Docker Compose
|
||||
|
||||
Run the application in development mode with hot reload:
|
||||
|
||||
```bash
|
||||
docker-compose -f docker-compose-dev.yml up
|
||||
```
|
||||
|
||||
The application will be available at `http://localhost:5173` with hot module replacement enabled.
|
||||
|
||||
To run in detached mode (background):
|
||||
```bash
|
||||
docker-compose -f docker-compose-dev.yml up -d
|
||||
```
|
||||
|
||||
To stop the development container:
|
||||
```bash
|
||||
docker-compose -f docker-compose-dev.yml down
|
||||
```
|
||||
|
||||
### Production with Docker Compose
|
||||
|
||||
Build and run the production image:
|
||||
|
||||
```bash
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
The application will be available at `http://localhost:80`
|
||||
|
||||
To run without rebuilding (if image already exists):
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
To stop the production container:
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
To view logs:
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
### Using Pre-built Docker Images
|
||||
|
||||
The project includes GitHub Actions workflows that automatically build and publish Docker images to GitHub Container Registry (ghcr.io) on releases. You can pull and run the latest release image:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/<your-username>/<your-repo-name>:V0.0.1-BETA
|
||||
docker run -d -p 80:80 ghcr.io/<your-username>/<your-repo-name>:V0.0.1-BETA
|
||||
```
|
||||
|
||||
## Configuration Data
|
||||
|
||||
The application uses JSON data files located in `website/src/data/`:
|
||||
|
||||
17
docker-compose-dev.yml
Normal file
17
docker-compose-dev.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
ossm-configurator-dev:
|
||||
image: node:20-alpine
|
||||
container_name: ossm-configurator-dev
|
||||
working_dir: /app
|
||||
volumes:
|
||||
- ./website:/app
|
||||
- /app/node_modules
|
||||
ports:
|
||||
- "5173:5173"
|
||||
command: sh -c "npm install && npm run dev -- --host"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
stdin_open: true
|
||||
tty: true
|
||||
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
services:
|
||||
ossm-configurator:
|
||||
image: ghcr.io/munchdev-oss/ossm-configurator:latest
|
||||
container_name: ossm-configurator
|
||||
ports:
|
||||
- "80:80"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ossm-configurator",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.1-beta",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
Reference in New Issue
Block a user