Skip to content

Commit 04d4472

Browse files
committed
operations gateway project page
1 parent f0b19c0 commit 04d4472

28 files changed

+6638
-0
lines changed

.dockerignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/.github
2+
**/build
3+
**/coverage
4+
**/cypress
5+
**/lib
6+
**/node_modules
7+
.git
8+
.gitignore
9+
.prettierrc
10+
codecov.yml
11+
cypress.config.ts
12+
docker-compose.yml
13+
renovate.json
14+
Dockerfile
15+
Dockerfile.prod
16+
License
17+
README.md
18+
.yarn/*
19+
!.yarn/releases
20+
!.yarn/plugins
21+
!.yarn/patches

.github/workflows/deploy.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2+
#
3+
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4+
#
5+
name: Deploy Next.js site to Pages
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["main"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
jobs:
28+
# Build job
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Detect package manager
36+
id: detect-package-manager
37+
run: |
38+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
39+
echo "manager=yarn" >> $GITHUB_OUTPUT
40+
echo "command=install" >> $GITHUB_OUTPUT
41+
echo "runner=yarn" >> $GITHUB_OUTPUT
42+
exit 0
43+
elif [ -f "${{ github.workspace }}/package.json" ]; then
44+
echo "manager=npm" >> $GITHUB_OUTPUT
45+
echo "command=ci" >> $GITHUB_OUTPUT
46+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
47+
exit 0
48+
else
49+
echo "Unable to determine package manager"
50+
exit 1
51+
fi
52+
53+
- name: Setup Node
54+
uses: actions/setup-node@v4
55+
with:
56+
node-version: "lts/*"
57+
cache: ${{ steps.detect-package-manager.outputs.manager }}
58+
59+
- name: Setup Pages
60+
uses: actions/configure-pages@v4
61+
62+
- name: Restore cache
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
.next/cache
67+
# Generate a new cache whenever packages or source files change.
68+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
69+
# If source files changed but packages didn't, rebuild from a prior cache.
70+
restore-keys: |
71+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
72+
73+
- name: Install dependencies
74+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
75+
76+
- name: Build with Next.js
77+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
78+
79+
- name: Upload artifact
80+
uses: actions/upload-pages-artifact@v3
81+
with:
82+
path: ./out
83+
84+
# Deployment job
85+
deploy:
86+
environment:
87+
name: github-pages
88+
url: ${{ steps.deployment.outputs.page_url }}
89+
runs-on: ubuntu-latest
90+
needs: build
91+
steps:
92+
- name: Deploy to GitHub Pages
93+
id: deployment
94+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

.lintstagedrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const path = require("path");
2+
3+
const buildEslintCommand = (filenames) =>
4+
`next lint --fix --file ${filenames
5+
.map((f) => path.relative(process.cwd(), f))
6+
.join(" --file ")}`;
7+
8+
module.exports = {
9+
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
10+
};

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Specify a base image
2+
FROM node:22.15.0-alpine3.21@sha256:ad1aedbcc1b0575074a91ac146d6956476c1f9985994810e4ee02efd932a68fd
3+
4+
# Set the working directory
5+
WORKDIR /operationsgateway-project-run
6+
7+
# Copy the application files
8+
COPY . .
9+
10+
# Install dependencies
11+
RUN yarn install
12+
13+
# Specify the default command
14+
# Docker cannot run with open as it cannot find a display
15+
CMD ["yarn", "dev"]
16+
17+
# Expose the application port
18+
EXPOSE 3000

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Next.js GitHub Pages Test
2+
3+
A sample [Next.js](https://nextjs.org) project configured for deployment to GitHub Pages, bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
4+
5+
## Table of Contents
6+
7+
- [Project Structure](#project-structure)
8+
- [Prerequisites](#prerequisites)
9+
- [Getting Started](#getting-started)
10+
- [Base Path for Images](#base-path-for-images)
11+
- [Deployment](#deployment)
12+
- [Learn More](#learn-more)
13+
14+
## Project Structure
15+
16+
```
17+
/ (root)
18+
├── docker-compose.yml
19+
├── Dockerfile
20+
├── eslint.config.mjs
21+
├── next.config.ts
22+
├── package.json
23+
├── tsconfig.json
24+
├── public/
25+
│ ├── scigateway-white-text-blue-mark-logo.svg
26+
│ └── UKRI_STFC_SCIENTIFIC_COMPUTING_RGB.png
27+
└── src/
28+
└── app/
29+
├── layout.tsx
30+
├── page.tsx
31+
└── theme.tsx
32+
```
33+
34+
## Prerequisites
35+
36+
- [Docker](https://docs.docker.com/get-docker/) (for containerized development)
37+
- [Node.js](https://nodejs.org/) (v18+ recommended)
38+
- [Yarn](https://yarnpkg.com/) (if not using Docker)
39+
40+
## Getting Started
41+
42+
### Using Docker
43+
44+
```bash
45+
docker compose up
46+
```
47+
48+
### Using Yarn
49+
50+
```bash
51+
yarn install
52+
yarn dev
53+
```
54+
55+
Open [http://localhost:3000/operationsgateway-project](http://localhost:3000/operationsgateway-project) in your browser to see the result.
56+
57+
You can start editing the page by modifying `src/app/page.tsx`. The page auto-updates as you edit the file.
58+
59+
## Base Path for Images
60+
61+
To ensure images appear correctly on GitHub Pages, update the `src` prop of your `Image` components in `src/app/page.tsx` to include the base path `/operationsgateway-project/` (the slug of this repository):
62+
63+
```tsx
64+
<Image
65+
src="/operationsgateway-project/vercel.svg"
66+
alt="Vercel Logo"
67+
className={styles.vercelLogo}
68+
width={100}
69+
height={24}
70+
priority
71+
/>
72+
```
73+
74+
Learn more in the [Next.js basePath and images documentation](https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath#images).
75+
76+
## Deployment
77+
78+
To deploy to GitHub Pages, follow the [Next.js GitHub Pages guide](https://github.com/gregrickaby/nextjs-github-pages) and ensure your `next.config.ts` is configured with the correct `basePath` and `assetPrefix`.
79+
80+
## Learn More
81+
82+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
83+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
84+
- [Next.js GitHub repository](https://github.com/vercel/next.js)

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3.9'
2+
3+
services:
4+
operationsgateway-project:
5+
container_name: operationsgateway-project_container
6+
build: .
7+
volumes:
8+
- ./src:/operationsgateway-project-run/src
9+
- ./public:/operationsgateway-project-run/public
10+
ports:
11+
- 3000:3000
12+
environment:
13+
- WATCHPACK_POLLING=true
14+
restart: on-failure

0 commit comments

Comments
 (0)