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

Self-Hosted pipeline npm run build step is being killed

bayarkhuu
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!
January 31, 2024
  • My Selft-Hosted runner is Online (Checked it on my runner settings).
  • docker build command works on my local machine. But not on bitbucker pipeline.

Full error log (i uploaded to github to simplify): https://raw.githubusercontent.com/seriseyes/bitbucket-error/main/error 


# bitbucket-pipelines.yml
image: node:21.6.0-alpine3.19

pipelines:
custom:
deploy:
- step:
runs-on: office
name: Build and Push Docker Image
size: 2x
script:
- docker info
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin harbor.medsoft.care
- TAG=$(echo $BITBUCKET_COMMIT | head -c 8) # Use the first 8 characters of the commit hash as the tag
- DOCKER_BUILDKIT=1 docker build -t harbor.medsoft.care/medsoft8/ui:$TAG .
- docker push harbor.medsoft.care/medsoft8/ui:$TAG
after-script:
- cat /root/.npm/_logs/*
services:
- docker

 

#Dockerfile
FROM node:21.6.0-alpine3.19 as builder

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

FROM nginx:alpine

WORKDIR /usr/share/nginx/html

RUN rm -rf ./*

COPY --from=builder /app/dist .

COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 3000

CMD ["nginx", "-g", "daemon off;"]

 

1 answer

2 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 2, 2024

Hi @bayarkhuu and welcome to the community!

The exit code: 137 mentioned in the logs you provided usually indicates a memory issue.

Your step has size: 2x, so 8 GB of memory will be available for this step (if the host machine has that memory available). However, the docker service gets only 1024 MB of that memory. This is the default amount of memory that a service gets unless you specify otherwise in your bitbucket-pipelines.yml file.

For a step with size: 2x, you can configure a service to use up to 7128 MB of memory. You can do that by adding in your bitbucket-pipelines.yml file a definition as follows (you can change the value to anything up to 7128):

definitions:
services:
docker:
memory: 2048

You can check our documentation on services for more details:

Please feel free to let me know how it goes and if you have any questions.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events