Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

i am trying to build a bitbucket pipeline for react app and having issue on building docker image

siddhant pandey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 24, 2024

i am building a docker image for react app using your bitbucket pipeline and it is taking so long for building approx one hour and at the step of building react build in docker it is saying this.


Step 7/11 : RUN npm run build ---> Running in 78d6a0056407 > 360-analytics@0.1.0 build > react-scripts build Creating an optimized production build... Browserslist: caniuse-lite is outdated. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme One of your dependencies, babel-preset-react-app, is importing the "@babel/plugin-proposal-private-property-in-object" package without declaring it in its dependencies. This is currently working because "@babel/plugin-proposal-private-property-in-object" is already in your node_modules folder for unrelated reasons, but it may break at any time. babel-preset-react-app is part of the create-react-app project, which is not maintianed anymore. It is thus unlikely that this bug will ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to your devDependencies to work around this error. This will make this message go away.

 

The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process. The command '/bin/sh -c npm run build' returned a non-zero code: 1


i am giving you mine dockerfile :- 

 

# Stage 1: Build the React app
FROM node:18 AS build

# Set the working directory
WORKDIR /app

# Install dependencies
COPY package.json package-lock.json ./
RUN npm install --legacy-peer-deps

# Copy the rest of the application code
COPY . .

# Build the React application
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN npm run build

# Stage 2: Serve the application using a minimal web server
FROM nginx:alpine

# Copy the build artifacts from the previous stage
COPY --from=build /app/build /usr/share/nginx/html

# Expose port 80 to the outside world
EXPOSE 80

# Start NGINX
CMD ["nginx", "-g", "daemon off;"]
also i am giving you my bitbucket pipeline:- 


 

image: atlassian/default-image:2

pipelines:
  default:
    - step:
        name: Build and Push Docker Image
        size: 2x
        services:
          - docker
        caches:
          - docker
        script:
          - echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
          - docker build -t ${DOCKER_USERNAME}/${IMAGE_NAME}:${BITBUCKET_COMMIT} .
          - docker push ${DOCKER_USERNAME}/${IMAGE_NAME}:${BITBUCKET_COMMIT}
    - step:
        name: Deploy to Server
        script:
          - apt-get update && apt-get install -y ssh
          - ssh -i /opt $SSH_USER@$SERVER <<EOF
            cd /opt
            docker-compose pull
            docker-compose up -d
            EOF

my question is how can i fix this issue by doing changes in my dockerfile or bitbucket file 

1 answer

2 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 26, 2024

Hi @siddhant pandey,

Welcome to the community.

If you haven't done it yet, could you try to increase your Docker service container's memory to 2 GB by adding the configuration below and see if that helps?

definitions:
  services:
    docker:
      memory: 2048

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events