Spaces:
Sleeping
Sleeping
Merge branch 'master' of https://github.com/aakashbansal-1/studio
Browse files- .github/workflows/sync-to-hub.yml +26 -0
- Dockerfile +55 -0
- README.md +11 -3
- next.config.ts +7 -5
- public/.gitkeep +1 -0
.github/workflows/sync-to-hub.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face Hub
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
# This action runs every time you push code to the 'main' branch
|
| 5 |
+
push:
|
| 6 |
+
branches:
|
| 7 |
+
- master
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
sync-to-hub:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
steps:
|
| 13 |
+
# Step 1: Check out the code from your GitHub repository
|
| 14 |
+
- name: Checkout repository
|
| 15 |
+
uses: actions/checkout@v4
|
| 16 |
+
with:
|
| 17 |
+
fetch-depth: 0
|
| 18 |
+
|
| 19 |
+
# Step 2: Push the code to your Hugging Face Space repository
|
| 20 |
+
- name: Push to Hugging Face Hub
|
| 21 |
+
env:
|
| 22 |
+
# This uses the HF_TOKEN we created in the previous step
|
| 23 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 24 |
+
run: |
|
| 25 |
+
# Push the 'master' branch from GitHub to the 'main' branch on Hugging Face
|
| 26 |
+
git push https://aakashbansal:${HF_TOKEN}@huggingface.co/spaces/aakashbansal/testchat master:main -f
|
Dockerfile
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Stage 1: Install dependencies and build the application
|
| 2 |
+
# We use node:20-slim as it's a small and efficient base image
|
| 3 |
+
FROM node:20-slim AS builder
|
| 4 |
+
|
| 5 |
+
# Set the working directory inside the container
|
| 6 |
+
WORKDIR /app
|
| 7 |
+
|
| 8 |
+
# Copy package manager files for NPM
|
| 9 |
+
COPY package.json package-lock.json ./
|
| 10 |
+
|
| 11 |
+
# Install dependencies using NPM's clean install command
|
| 12 |
+
# Also install the missing peer dependency for genkit/opentelemetry
|
| 13 |
+
RUN npm ci && npm install @opentelemetry/exporter-jaeger
|
| 14 |
+
|
| 15 |
+
# Copy the rest of your application's source code into the container
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# Build the Next.js application for production
|
| 19 |
+
# We set an environment variable to disable Jaeger during the build process
|
| 20 |
+
RUN OTEL_TRACES_EXPORTER=none npm run build
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# Stage 2: Create the final, small production image from the build artifacts
|
| 24 |
+
FROM node:20-slim AS runner
|
| 25 |
+
|
| 26 |
+
WORKDIR /app
|
| 27 |
+
|
| 28 |
+
# Set the environment to production to enable Next.js optimizations
|
| 29 |
+
ENV NODE_ENV=production
|
| 30 |
+
ENV NEXT_TELEMETRY_DISABLED 1
|
| 31 |
+
|
| 32 |
+
# --- PERMISSIONS FIX ---
|
| 33 |
+
# Create a non-root user and group for security
|
| 34 |
+
RUN addgroup --system --gid 1001 nodejs
|
| 35 |
+
RUN adduser --system --uid 1001 nextjs
|
| 36 |
+
|
| 37 |
+
# Copy the standalone output, static assets, and public folder
|
| 38 |
+
# And give the new 'nextjs' user ownership of them
|
| 39 |
+
COPY --chown=nextjs:nodejs --from=builder /app/.next/standalone ./
|
| 40 |
+
COPY --chown=nextjs:nodejs --from=builder /app/.next/static ./.next/static
|
| 41 |
+
COPY --chown=nextjs:nodejs --from=builder /app/public ./public
|
| 42 |
+
|
| 43 |
+
# Switch to the non-root user
|
| 44 |
+
USER nextjs
|
| 45 |
+
# --- END PERMISSIONS FIX ---
|
| 46 |
+
|
| 47 |
+
# Expose the port that Next.js will run on. The default is 3000.
|
| 48 |
+
EXPOSE 3000
|
| 49 |
+
|
| 50 |
+
# Set the port environment variable for the container
|
| 51 |
+
ENV PORT=3000
|
| 52 |
+
|
| 53 |
+
# The command to start the Next.js server.
|
| 54 |
+
# This will now run as the 'nextjs' user.
|
| 55 |
+
CMD ["node", "server.js"]
|
README.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: My Next.js App
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 3000
|
| 8 |
+
---
|
| 9 |
|
| 10 |
+
# My Next.js Chat Demo
|
| 11 |
|
| 12 |
+
This is the official repository for my Next.js chat application.
|
| 13 |
+
The live demo is deployed automatically to Hugging Face Spaces.
|
next.config.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
import type {NextConfig} from 'next';
|
| 3 |
|
| 4 |
const nextConfig: NextConfig = {
|
| 5 |
-
/
|
|
|
|
|
|
|
|
|
|
| 6 |
typescript: {
|
| 7 |
ignoreBuildErrors: true,
|
| 8 |
},
|
|
@@ -21,9 +23,9 @@ const nextConfig: NextConfig = {
|
|
| 21 |
},
|
| 22 |
experimental: {
|
| 23 |
allowedDevOrigins: [
|
| 24 |
-
|
| 25 |
],
|
| 26 |
-
}
|
| 27 |
};
|
| 28 |
|
| 29 |
export default nextConfig;
|
|
|
|
| 1 |
+
import type { NextConfig } from 'next';
|
|
|
|
| 2 |
|
| 3 |
const nextConfig: NextConfig = {
|
| 4 |
+
// Add this line for optimal Docker deployment
|
| 5 |
+
output: 'standalone',
|
| 6 |
+
|
| 7 |
+
/* existing config options */
|
| 8 |
typescript: {
|
| 9 |
ignoreBuildErrors: true,
|
| 10 |
},
|
|
|
|
| 23 |
},
|
| 24 |
experimental: {
|
| 25 |
allowedDevOrigins: [
|
| 26 |
+
'https://6000-firebase-studio-1749886052794.cluster-zumahodzirciuujpqvsniawo3o.cloudworkstations.dev',
|
| 27 |
],
|
| 28 |
+
},
|
| 29 |
};
|
| 30 |
|
| 31 |
export default nextConfig;
|
public/.gitkeep
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|