fix dockerfile to build nextjs app
This commit is contained in:
parent
024385491f
commit
6e1c398ee9
|
@ -2,3 +2,4 @@ node_modules
|
||||||
.git
|
.git
|
||||||
.editorconfig
|
.editorconfig
|
||||||
.gitignore
|
.gitignore
|
||||||
|
.next
|
||||||
|
|
41
Dockerfile
41
Dockerfile
|
@ -1,40 +1,47 @@
|
||||||
# Stage 1: Compile and Build the app
|
# Stage 1: Compile and Build the app
|
||||||
|
|
||||||
# Node veersion
|
# Node veersion
|
||||||
FROM node:14.15.1 as build
|
FROM node:14.17.3-alpine as build
|
||||||
|
|
||||||
# update
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||||
|
RUN apk add --no-cache libc6-compat git
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get -y install curl gnupg
|
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
|
||||||
RUN apt-get -y install nodejs
|
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /usr/local/app
|
WORKDIR /app
|
||||||
|
|
||||||
# Add the source code to app
|
# Add the source code to app
|
||||||
COPY ./ /usr/local/app/
|
COPY ./js /app
|
||||||
|
|
||||||
WORKDIR js
|
|
||||||
# Install all the dependencies
|
# Install all the dependencies
|
||||||
RUN yarn install
|
RUN yarn install --frozen-lockfile
|
||||||
RUN yarn bootstrap
|
RUN yarn bootstrap
|
||||||
|
|
||||||
# HERE ADD YOUR STORE WALLET ADDRESS
|
# HERE ADD YOUR STORE WALLET ADDRESS
|
||||||
ENV REACT_APP_STORE_OWNER_ADDRESS_ADDRESS=""
|
ENV REACT_APP_STORE_OWNER_ADDRESS_ADDRESS=""
|
||||||
|
|
||||||
# Generate the build of the application
|
# Generate the build of the application
|
||||||
ENV GENERATE_SOURCEMAP=false
|
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
# Stage 2: Serve app with nginx server
|
# Stage 2: Serve app with nginx server
|
||||||
|
|
||||||
# Use official nginx image as the base image
|
# Production image, copy all the files and run next
|
||||||
FROM nginx:latest
|
FROM node:14.17.3-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV production
|
||||||
|
|
||||||
|
RUN addgroup -g 1001 -S nodejs
|
||||||
|
RUN adduser -S nextjs -u 1001
|
||||||
|
|
||||||
# Copy the build output to replace the default nginx contents.
|
# Copy the build output to replace the default nginx contents.
|
||||||
COPY --from=build /usr/local/app/js/build/web /usr/share/nginx/html
|
COPY --from=build /app/packages/web/next.config.js ./
|
||||||
|
COPY --from=build /app/packages/web/public ./public
|
||||||
|
COPY --from=build --chown=nextjs:nodejs /app/packages/web/.next ./.next
|
||||||
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
|
COPY --from=build /app/packages/web/package.json ./package.json
|
||||||
|
|
||||||
# Expose port 80
|
USER nextjs
|
||||||
EXPOSE 80
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["yarn", "start:prod"]
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
GENERATE_SOURCEMAP=false
|
|
|
@ -27,6 +27,9 @@ const plugins = [
|
||||||
|
|
||||||
module.exports = withPlugins(plugins, {
|
module.exports = withPlugins(plugins, {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
|
eslint: {
|
||||||
|
ignoreDuringBuilds: true,
|
||||||
|
},
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
"prestart": "npm-link-shared ../common/node_modules/ . react",
|
"prestart": "npm-link-shared ../common/node_modules/ . react",
|
||||||
"start": "next dev",
|
"start": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
|
"start:prod": "next start",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"deploy:ar": "arweave deploy-dir ../../build/web --key-file ",
|
"deploy:ar": "arweave deploy-dir ../../build/web --key-file ",
|
||||||
"deploy": "gh-pages -d ../../build/web --repo https://github.com/metaplex-foundation/metaplex",
|
"deploy": "gh-pages -d ../../build/web --repo https://github.com/metaplex-foundation/metaplex",
|
||||||
|
|
Loading…
Reference in New Issue