diff --git a/.env b/.env index 6438362..6a3baae 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ +MONGODB_URI=mongodb://scuser:pass@127.0.0.1/scaledb NEXT_PUBLIC_HOSTNAME=http://localhost:3000/api/ -NEXT_PUBLIC_NEXTAUTH_URL=http://localhost:3000/ \ No newline at end of file +NEXT_PUBLIC_NEXTAUTH_URL=http://localhost:3000/ diff --git a/Dockerfile b/Dockerfile index 103758a..c94ff99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,41 +1,30 @@ -# Stage 1: Build +FROM ubuntu:latest -FROM node:21-alpine AS build +# Set environment variables to avoid prompts and for better apt performance +ENV DEBIAN_FRONTEND=noninteractive + +# Install required packages: curl, gnupg, git, nodejs, npm +RUN apt update && apt install -y \ + git \ + nodejs \ + npm \ + curl \ + gnupg # Set /app as the Working Directory on Docker filesystem WORKDIR /app - -# Copy package.json and package-lock.json COPY package*.json ./ +COPY . . # Install dependencies -RUN npm install +RUN npm install && npm install next && npm install papaparse -# Copy the rest of the application code -COPY . . -# Build the Next.js app +RUN chmod +x dbinstall.sh && ./dbinstall.sh +RUN chmod +x dbinit.sh RUN npm run build - - -# Stage 2: Run - -FROM node:21-alpine AS run - -# Set /app as the Working Directory on Docker filesystem -WORKDIR /app - -# Copy only necessary files from the build stage -COPY --from=build /app/package*.json ./ -COPY --from=build /app/.next ./.next -COPY --from=build /app/public ./public - -# Install only production dependencies -RUN npm install --only=production - -# Expose the port that your Next.js app will run on -EXPOSE 3000 - -# Start the Next.js app -CMD ["npm", "start"] - +# Expose the ports for Next.js app and MongoDB +EXPOSE 3000 +EXPOSE 27017 +ENTRYPOINT ["/bin/bash", "/app/dbinit.sh"] +CMD ["npm", "start" ] diff --git a/dbinit.sh b/dbinit.sh new file mode 100644 index 0000000..ef3b4ba --- /dev/null +++ b/dbinit.sh @@ -0,0 +1,32 @@ +#!/bin/bash +MONGO_HOST="127.0.0.1" # Change to your MongoDB host if not localhost +MONGO_PORT="27017" # Change to your MongoDB port if not default +USERNAME="scuser" # Replace with your desired username +PASSWORD="pass" # Replace with your desired password +mongod --fork --logpath /var/log/mongod.log --bind_ip 0.0.0.0 +# Wait for MongoDB to start +until mongosh --host localhost --port 27017 --eval "print('waiting for connection...')"> /dev/null 2>&1; do + sleep 2 +done + + + +# Create the custom database and user with roles +mongosh --host localhost --port 27017 < { + const handleFileUpload = (e) => { + const file = e.target.files[0]; + if (file) { + Papa.parse(file, { + complete: (result) => { + console.log("Parsed Data:", result.data); + alert("CSV data loaded. Check console for output!"); + }, + header: true, + }); + } + }; + + return ( +
+

Upload CSV

+ +

Select a CSV file to upload and parse its content.

+
+ ); +}; + +export default importCSVDrawer; diff --git a/src/components/home/footer.jsx b/src/components/home/footer.jsx new file mode 100644 index 0000000..230d280 --- /dev/null +++ b/src/components/home/footer.jsx @@ -0,0 +1,12 @@ +// src/components/home/Footer.jsx + +const footer = () => { + return ( + + ); +}; + +export default footer; + diff --git a/src/components/home/topNavbar.jsx b/src/components/home/topNavbar.jsx new file mode 100644 index 0000000..4b432a6 --- /dev/null +++ b/src/components/home/topNavbar.jsx @@ -0,0 +1,16 @@ +// src/components/home/TopNavbar.jsx + +const topNavbar = () => { + return ( + + ); +}; + +export default topNavbar;

AltStyle によって変換されたページ (->オリジナル) /