Compare commits
4 Commits
new-update
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 08cc572325 | |||
| 22742c2c1f | |||
| 255700b5db | |||
| 0d8130bc81 |
77
Dockerfile
77
Dockerfile
@ -1,50 +1,75 @@
|
|||||||
# Use smaller base image
|
# Base image for all stages
|
||||||
FROM node:18-alpine AS base
|
FROM node:20-alpine AS base
|
||||||
|
|
||||||
# Install dependencies only when needed
|
### Dependencies Stage ###
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN apk add --no-cache libc6-compat
|
# Set a fast and reliable Alpine mirror
|
||||||
|
# Check if 'git' is needed (only required if package.json has Git-based dependencies)
|
||||||
|
RUN echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.22/main" > /etc/apk/repositories && \
|
||||||
|
echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.22/community" >> /etc/apk/repositories && \
|
||||||
|
apk update --verbose && \
|
||||||
|
apk add --no-cache --verbose libc6-compat git
|
||||||
|
|
||||||
|
# Setup pnpm environment
|
||||||
|
ENV PNPM_HOME="/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
RUN corepack enable
|
||||||
|
RUN corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files
|
# Install dependencies with pnpm
|
||||||
COPY package.json pnpm-lock.yaml* ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
RUN corepack enable pnpm && pnpm install --frozen-lockfile --production=false
|
RUN pnpm install --frozen-lockfile --prefer-frozen-lockfile
|
||||||
|
|
||||||
# Build the source code
|
### Builder Stage ###
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
# Enable pnpm
|
||||||
|
RUN corepack enable
|
||||||
|
RUN corepack prepare pnpm@latest --activate
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy node_modules from deps stage
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
# Copy all source files
|
||||||
COPY . .
|
COPY . .
|
||||||
|
# Debug: List files in components/research to verify presence
|
||||||
|
# RUN ls -l /app/components/research/
|
||||||
|
# Build the Next.js application
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
# Optimize build process
|
### Production Runner Stage ###
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
|
|
||||||
# Build with optimizations
|
|
||||||
RUN corepack enable pnpm && \
|
|
||||||
pnpm build && \
|
|
||||||
pnpm prune --production
|
|
||||||
|
|
||||||
# Production image
|
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
# Set production environment
|
||||||
|
ENV NODE_ENV production
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
# Disable Next.js telemetry
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
# Learn more: https://nextjs.org/telemetry
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
# Create non-root user and set permissions
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN addgroup nodejs
|
||||||
|
RUN adduser -SDH nextjs
|
||||||
|
RUN mkdir .next
|
||||||
|
RUN chown nextjs:nodejs .next
|
||||||
|
|
||||||
# Copy built application
|
# Copy built artifacts with correct ownership
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
|
||||||
|
# Switch to non-root user
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
|
# Expose port for the application
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
ENV PORT 3000
|
||||||
|
ENV HOSTNAME "0.0.0.0"
|
||||||
|
|
||||||
ENV PORT=3000
|
# Healthcheck using curl (available in node:20-alpine, unlike wget)
|
||||||
ENV HOSTNAME="0.0.0.0"
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
||||||
|
CMD curl -f http://localhost:3000/health || exit 1
|
||||||
|
|
||||||
|
# Start the Next.js application
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
@ -1,16 +1,16 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Geist, Geist_Mono } from "next/font/google";
|
// import { Geist, Geist_Mono } from "next/font/google";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
|
||||||
const geistSans = Geist({
|
// const geistSans = Geist({
|
||||||
variable: "--font-geist-sans",
|
// variable: "--font-geist-sans",
|
||||||
subsets: ["latin"],
|
// subsets: ["latin"],
|
||||||
});
|
// });
|
||||||
|
|
||||||
const geistMono = Geist_Mono({
|
// const geistMono = Geist_Mono({
|
||||||
variable: "--font-geist-mono",
|
// variable: "--font-geist-mono",
|
||||||
subsets: ["latin"],
|
// subsets: ["latin"],
|
||||||
});
|
// });
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Operify Tech - A Leader in Next Generation Sequencing (NGS) Technology",
|
title: "Operify Tech - A Leader in Next Generation Sequencing (NGS) Technology",
|
||||||
@ -24,9 +24,10 @@ export default function RootLayout({
|
|||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body
|
{/* <body
|
||||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||||
>
|
> */}
|
||||||
|
<body>
|
||||||
{children}
|
{children}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -2,9 +2,9 @@ import React from 'react';
|
|||||||
import PageLayout from '../components/Layout/PageLayout';
|
import PageLayout from '../components/Layout/PageLayout';
|
||||||
import ResearchHero from '../components/Research/ResearchHero'
|
import ResearchHero from '../components/Research/ResearchHero'
|
||||||
import PlantResearch from '../components/Research/PlantResearch';
|
import PlantResearch from '../components/Research/PlantResearch';
|
||||||
import AnimalResearch from '../components/research/AnimalResearch';
|
import AnimalResearch from '../components/Research/AnimalResearch';
|
||||||
import MicrobialResearch from '../components/research/MicrobialResearch';
|
import MicrobialResearch from '../components/Research/MicrobialResearch';
|
||||||
import HumanResearch from '../components/research/HumanResearch';
|
import HumanResearch from '../components/Research/HumanResearch';
|
||||||
|
|
||||||
export default function ResearchPage() {
|
export default function ResearchPage() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user