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

Wondering ways to maybe improve time to build of my Pipeline?

Deleted user May 8, 2020

I've customized the default Atlassian Dockerfile to create a custom image. I added the git-ftp installation as well as Gulp installation in hopes of cutting down on the Pipeline time.

Builds are taking just as long as before, but all the time is during the Build Setup. Is there a way to configure the image or the pipeline so the installations don't run from scratch during the Build Setup every time my pipeline runs?

 

Dockerfile

FROM ubuntu:16.04

# Install base dependencies
RUN apt-get update \
&& apt-get install -y \

software-properties-common \

build-essential \

wget \

xvfb \

curl \

git \

mercurial \

maven \

openjdk-8-jdk \

ant \

ssh-client \

unzip \

iputils-ping \

&& rm -rf /var/lib/apt/lists/*

# Install Git-ftp and update permissions
RUN curl https://raw.githubusercontent.com/git-ftp/git-ftp/master/git-ftp > /usr/bin/git-ftp \ && chmod 755 /usr/bin/git-ftp

# Install nvm with node and npm
ENV NODE_VERSION=12.16.2 \
NVM_DIR=/root/.nvm \

NVM_VERSION=0.35.3

RUN curl https://raw.githubusercontent.com/creationix/nvm/v$NVM_VERSION/install.sh | bash \
&& . $NVM_DIR/nvm.sh \

&& nvm install $NODE_VERSION \

&& nvm alias default $NODE_VERSION \

&& nvm use default \

&& npm install -g gulp


# Set node path
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

# Default to UTF-8 file.encoding
ENV LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ LANGUAGE=C.UTF-8

# Xvfb provide an in-memory X-session for tests that require a GUI
ENV DISPLAY=:99

# Set the path.
ENV PATH=$NVM_DIR:$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

# Create dirs and users
RUN mkdir -p /opt/atlassian/bitbucketci/agent/build \ && sed -i '/[ -z \"PS1\" ] && return/a\\ncase $- in\n*i*) ;;\n*) return;;\nesac' /root/.bashrc \ && useradd --create-home --shell /bin/bash --uid 1000 pipelines

WORKDIR /opt/atlassian/bitbucketci/agent/buildENTRYPOINT /bin/bash

 

bitbucket-pipelines.yml

# Only use spaces to indent your .yml configuration.
# You can specify a custom docker image from Docker Hub as your build environment.
image: (CUSTOM IMAGE)
clone:
depth: 5
pipelines:
custom:
DEV - Push All: # Manual step. Used to force push ALL files to web server
-
step:
deployment: test
caches:
-
node
script:
#- curl -s http://whatismyip.akamai.com/
-
npm install
-
gulp build
-
export PATH=".:$PATH"
#- git-ftp --version
#- git status
-
git reset --hard
-
if [ $BITBUCKET_BRANCH == 'master' ]; then git ftp push -a -u "$DEV_FTP_USERNAME" -p "$DEV_FTP_PASSWORD" ftp://$DEV_FTP_HOST/$DEV_FOLDER_NAME; fi

DEV - Catchup: # Manual step. Creates the .git-ftp.log file and does not push any files. It assumes files were already present during initialization
-
step:
deployment: production
script:
-
if [ $BITBUCKET_BRANCH == 'master' ]; then git ftp catchup -u "$DEV_FTP_USERNAME" -p "$DEV_FTP_PASSWORD" ftp://$DEV_FTP_HOST/$DEV_FOLDER_NAME; fi

branches: # Automated triggers on commits to branches master: # When committing to development branch
-
step:
name: Deploy to test
deployment: test
caches:
-
node
script:
#- curl -s http://whatismyip.akamai.com/
-
npm install
-
gulp build
-
export PATH=".:$PATH"
#- git-ftp --version
#- git status
-
git reset --hard
-
if [ $BITBUCKET_BRANCH == 'master' ]; then git ftp push --auto-init -u "$DEV_FTP_USERNAME" -p "$DEV_FTP_PASSWORD" ftp://$DEV_FTP_HOST/$DEV_FOLDER_NAME -vv; fi

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events