Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Optimize docker iage

Khuram Niazf3a649e9373a
diff --git a/Dockerfile b/Dockerfile
index cc74d57..7d072f8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,14 +24,15 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
-# COPY ./prisma prisma/
-# COPY ./src src
-
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
ENV NEXT_TELEMETRY_DISABLED 1
ENV DATABASE_URL=file:/data/dev.db
+# Add the wait script to ensure the database is ready before running migrations
+ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
+RUN chmod +x /wait
+
# Generate Prisma client
RUN npx prisma generate
@@ -46,7 +47,6 @@ RUN \
FROM base AS runner
WORKDIR /app
-ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1
# Set environment variables
@@ -62,23 +62,19 @@ ENV AUTH_TRUST_HOST: http://localhost:3000
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
-# COPY --from=builder /app/public ./public
-
# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next
-# Add the wait script to ensure the database is ready before running migrations
-ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
-RUN chmod +x /wait
-
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
-# COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
-# COPY --from=builder --chown=nextjs:nodejs /app/.next/docstatic ./.next/static
-COPY --from=builder --chown=nextjs:nodejs /app /app
+COPY --from=builder /app/public ./public
+COPY --from=builder /app/prisma ./prisma
+COPY --from=builder /app/src/lib/data ./src/lib/data
+COPY --from=builder /app/node_modules/bcryptjs ./node_modules/bcryptjs
+COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
+COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
-# Run the wait script, then run migrations and seed the database
USER nextjs
EXPOSE 3000
@@ -86,4 +82,4 @@ EXPOSE 3000
ENV PORT 3000
# Start the jobsync application
-CMD /wait && npx prisma migrate deploy && npx prisma generate && npm run seed && npm start
+CMD npx prisma migrate deploy && npm run seed && node server.js
diff --git a/next.config.mjs b/next.config.mjs
index d5ffe88..8ac27d7 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -1,14 +1,15 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
- async redirects() {
- return [
- {
- source: '/',
- destination: '/dashboard',
- permanent: true,
- },
- ]
+ async redirects() {
+ return [
+ {
+ source: "/",
+ destination: "/dashboard",
+ permanent: true,
},
+ ];
+ },
+ output: "standalone",
};
export default nextConfig;
diff --git a/prisma/seed.js b/prisma/seed.js
index d4155ed..8ef35d7 100644
--- a/prisma/seed.js
+++ b/prisma/seed.js
@@ -7,8 +7,8 @@ const prisma = new PrismaClient();
async function seedUser() {
try {
- const password = await bcrypt.hash("password123", 10);
- const email = "[email protected]";
+ const password = await bcrypt.hash(process.env.USER_PASSWORD, 10);
+ const email = process.env.USER_EMAIL;
// Check if the user already exists
const existingUser = await prisma.user.findUnique({
where: {