diff --git a/.env.example b/.env.example index 7334213..223ec40 100644 --- a/.env.example +++ b/.env.example @@ -3,4 +3,6 @@ # DEVELOPMENT TOOLS # Ideally, don't add them to production deployment envs # !STARTERCONF Change to true if you want to log data -NEXT_PUBLIC_SHOW_LOGGER="false" \ No newline at end of file +NEXT_PUBLIC_SHOW_LOGGER="false" +PORT=3400 +NEXT_PUBLIC_MARKETPLACE_BACKEND_URL='http://localhost:4020' \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..366a841 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +# Stage 1: Build Stage +FROM node:18-alpine AS build + +# Set the working directory inside the container +WORKDIR /app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code to the container +COPY . . +COPY .env.example ./env.local + +# Build the Next.js app +RUN npm run build + +# Stage 2: Runtime Stage +FROM node:18-alpine + +# Set the working directory inside the container +WORKDIR /app + +# Copy only necessary files from the build stage +ENV NODE_ENV production + +COPY --from=build /app/next.config.js ./next.config.js +COPY --from=build /app/public ./public +COPY --from=build /app/package.json ./package.json +COPY --from=build /app/.next/standalone ./ +COPY --from=build /app/.next/static ./.next/static +COPY .env.example ./env.local + +# Expose the desired port +EXPOSE 3400 + +# Start the Next.js app +CMD ["node", "server.js"] diff --git a/config.js b/config.js index 47c5d2f..3656c30 100644 --- a/config.js +++ b/config.js @@ -1,5 +1,5 @@ const marketBackendUrl = - process.env.NEXT_PUBLIC_MARKETPLACE_BACKEND_URL || 'http://localhost:3000'; + process.env.NEXT_PUBLIC_MARKETPLACE_BACKEND_URL || 'http://localhost:4020'; module.exports = { marketBackendUrl, diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8645dce --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' + +services: + marketplace-ui: + build: + context: . + dockerfile: Dockerfile + ports: + - "3400:3000" + networks: + - samagra_compass + +networks: + samagra_compass: + external: true diff --git a/next.config.js b/next.config.js index 6352a3b..4285e83 100644 --- a/next.config.js +++ b/next.config.js @@ -6,7 +6,7 @@ const nextConfig = { reactStrictMode: true, swcMinify: true, - + output: 'standalone', // Uncoment to add domain whitelist images: { remotePatterns: [