Comments (5)
@serranomorante did you suceed ?
Maybe. I'm using this on production, but I did it almost in a hurry. I still hope it can help you to have something until saleor releases an official version.
# Step 1. Rebuild the source code only when needed
FROM node:18-alpine AS builder
RUN npm install -g pnpm
WORKDIR /app
# Copy lock files if file exists
COPY ./frontend/package.json ./frontend/pnpm-lock.yaml ./
# Omit --production flag for TypeScript devDependencies
RUN pnpm install
COPY ./frontend/ ./
# Run eslint
RUN pnpm run lint
# Environment variables must be present at build time
# https://github.com/vercel/next.js/discussions/14030
ARG API_URI
ENV API_URI ${API_URI:-http://localhost:8000/graphql/}
# Uncomment the following line to disable telemetry at build time
# ENV NEXT_TELEMETRY_DISABLED 1
# Build app
RUN pnpm run build
# Step 2. Production image, copy all the files and run next
FROM node:18-alpine AS runner
WORKDIR /app
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# My custom start and entrypoint files
COPY ./compose/production/frontend/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
COPY ./compose/production/frontend/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint
# USER nextjs
# COPY --from=builder /app/public ./public
# COPY --from=builder /app/next.config.js .
# COPY --from=builder /app/package.json .
COPY --from=builder /app ./
# 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/static ./.next/static
# Environment variables must be redefined at run time
# ARG ENV_VARIABLE
# ENV ENV_VARIABLE=${ENV_VARIABLE}
# ARG NEXT_PUBLIC_ENV_VARIABLE
# ENV NEXT_PUBLIC_ENV_VARIABLE=${NEXT_PUBLIC_ENV_VARIABLE}
ARG API_URI
# -> the backend app
ENV API_URI ${API_URI:-http://localhost:8000/graphql/}
ENV NEXT_PUBLIC_STOREFRONT_NAME="Your app name"
ARG NEXT_PUBLIC_API_URI
ENV NEXT_PUBLIC_API_URI=${NEXT_PUBLIC_API_URI:-https://vercel.saleor.cloud/graphql/}
ARG NEXT_PUBLIC_API_URI_INSECURE
ENV NEXT_PUBLIC_API_URI_INSECURE=${NEXT_PUBLIC_API_URI_INSECURE:-http://vercel.saleor.cloud/graphql/}
ENV NEXT_PUBLIC_DEFAULT_CHANNEL=default-channel
ENV NEXT_PUBLIC_HOMEPAGE_MENU=navbar
# -> the frontend app
ENV NEXT_PUBLIC_VERCEL_URL=https://localhost:3001
ENV NEXT_PUBLIC_DEMO_MODE=false
ENV NEXT_PUBLIC_GEOLOCATION=false
ENV NEXT_PUBLIC_ALLOWED_IMAGE_DOMAINS=img.youtube.com,i.ytimg.com,s3.amazonaws.com
ENV NEXT_PUBLIC_IMAGE_CONVERSION_FORMATS=image/avif,image/webp
ENV NEXT_PUBLIC_CHECKOUT_URL=
# Uncomment the following line to disable telemetry at run time
# ENV NEXT_TELEMETRY_DISABLED 1
# ENTRYPOINT ["/entrypoint"]
CMD ["node_modules/.bin/next", "start"]
from storefront.
Why is this closed? I'm going to try to create my own production Dockerfile and share it here later.
from storefront.
It was closed automatically by GitHub when we merged the repositories of Checkout and React Storefront.
Maintaining a docker image is something we definitely have on our roadmap.
from storefront.
I too have run into this issue, and would prefer not to deploy this way with pnpm run start
but rather the built assets.
from storefront.
@serranomorante did you suceed ?
from storefront.
Related Issues (20)
- Fix the Stripe bug in the checkout
- Empty toast message for missing fields HOT 1
- Auto capitalize postal code HOT 2
- Add attributes to password fields
- Move billing and summary above "payment" button
- Fix spacing in checkout page
- Parametrize GraphQL queries to allow passing channel
- Pass current channel in URL HOT 2
- Order List: Finalise payments for non-paid orders
- Add Dockerfile HOT 1
- Migrate Auth to App Router in Storefront HOT 1
- Check metabase Slack notifiacations and define one for storefront
- Bug: `update types workflow` is missing `schema.graphql`
- Rename current channels to `us` and `eu`
- Can't build the container image during `pnpm build` HOT 8
- Cookie cause bug HOT 1
- The product is still Out Of Stock in a storefront, even if there is 1 item in each warehouse
- Add env variable for default channel HOT 2
- Account login not working HOT 2
- Docker Build Error ARG or ENV missing during build process NEXT_PUBLIC_SALEOR_API_URL HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storefront.