Skip to content
Closed
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
41 changes: 2 additions & 39 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,57 +1,20 @@
# Configuration and environment
**/config/
server/.env
.env*

# Dependencies/modules
**/node_modules/

# Build/distribution files (these are built fresh in Docker)
# Build/distribution files
**/build/
**/dist/

# Version control
**/.git/
.gitignore
.gitattributes

# IDE files
.vscode
.idea
*.swp
*.swo
*~

# Testing
**/__tests__/
**/*.test.ts
**/*.test.tsx
**/*.spec.ts
**/*.spec.tsx
**/coverage/

# Documentation
README.md
CHANGELOG.md
LICENSE
**/*.md

# CI/CD
.github/
.gitlab-ci.yml
.travis.yml

# macOS files
**/.DS_Store
.AppleDouble
.LSOverride

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Lockfiles for other package managers
yarn.lock
pnpm-lock.yaml
**/.DS_Store
13 changes: 0 additions & 13 deletions .github/dependabot.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
node-version: 22
- name: Install dependencies
run: npm install --legacy-peer-deps --prefer-offline --no-audit
run: npm ci --legacy-peer-deps
working-directory: ./server
- name: Run build
run: npm run build
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
if: needs.check_authorization.outputs.isAuthorized == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand All @@ -36,10 +34,4 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
tags: |
ghcr.io/libretexts/conductor:${{ inputs.version }}
ghcr.io/libretexts/conductor:latest
build-args: |
VERSION=${{ inputs.version }}
BUILD_DATE=${{ github.event.repository.updated_at }}
VCS_REF=${{ github.sha }}
tags: ghcr.io/libretexts/conductor:${{ inputs.version }}
79 changes: 24 additions & 55 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,67 +1,36 @@
# Stage 1: Build client
FROM node:22-alpine3.22 AS client-builder
WORKDIR /usr/src/conductor/client

# Install git (needed for git dependencies in package.json)
RUN apk add --no-cache git

# Copy package.json only (let npm resolve dependencies for Linux)
COPY client/package.json ./
RUN npm install --no-audit

# Copy source and build
COPY client/ ./
RUN npm run build

# Stage 2: Build server
FROM node:22-alpine3.22 AS server-builder
WORKDIR /usr/src/conductor/server

# Copy package.json only (let npm resolve dependencies for Linux)
COPY server/package.json ./
RUN npm install --no-audit
FROM node:22-alpine3.22
LABEL org.opencontainers.image.source="https://github.com/LibreTexts/conductor"

# Copy source and build
COPY server/ ./
# Ensure public directory exists (even if not in source)
RUN mkdir -p ./public
RUN npm run build
WORKDIR /usr/src/conductor

# Stage 3: Production runtime
FROM node:22-alpine3.22
COPY . .

# Build arguments for dynamic labels
ARG VERSION=dev
ARG BUILD_DATE
ARG VCS_REF
# Install system dependencies (primarily for canvas)
RUN apk add --update --no-cache \
make \
g++ \
jpeg-dev \
cairo-dev \
giflib-dev \
pango-dev \
libtool \
autoconf \
automake

# OCI Image Labels (https://github.com/opencontainers/image-spec/blob/main/annotations.md)
LABEL org.opencontainers.image.title="LibreTexts Conductor" \
org.opencontainers.image.description="The LibreTexts Conductor platform Docker image" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.vendor="LibreTexts" \
org.opencontainers.image.documentation="https://github.com/LibreTexts/conductor/blob/master/README.md" \
org.opencontainers.image.source="https://github.com/LibreTexts/conductor" \
org.opencontainers.image.licenses="MIT"
# Install client dependencies and build frontend
WORKDIR /usr/src/conductor/client
RUN npm ci && npm run build

# Install server dependencies
WORKDIR /usr/src/conductor/server
RUN npm ci

# Copy package.json only and install ONLY production dependencies
COPY server/package.json ./
RUN npm install --no-audit --omit=dev && \
npm cache clean --force

# Copy built artifacts from previous stages
COPY --from=server-builder /usr/src/conductor/server/dist ./dist
COPY --from=server-builder /usr/src/conductor/server/util ./util
COPY --from=server-builder /usr/src/conductor/server/public ./public
COPY --from=client-builder /usr/src/conductor/client/dist ../client/dist
# Build server
RUN npm run build

EXPOSE 5000

HEALTHCHECK --interval=10s --timeout=5s --start-period=45s --retries=3 \
HEALTHCHECK --timeout=5s --start-period=30s \
CMD wget -nv -t1 --spider http://localhost:5000/health || exit 1

ENTRYPOINT [ "node", "dist/server.js" ]
ENTRYPOINT [ "node", "dist/server.js" ]
3 changes: 1 addition & 2 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/normalize.css" />
<title>LibreCommons</title>
<meta name="description" content="LibreCommons is a public library of open-access texts and Open Educational Resources. Find texts, explore reusable assessment modules, and collaborate with contributors.">
<meta property="og:title" content="LibreCommons">
Expand All @@ -26,8 +27,6 @@
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<!-- Runtime environment config injected by server -->
<script src="/env.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-0P2RT3G484"></script>
<script>
Expand Down
Loading
Loading