Hi there!
Some time ago, our project was migrated from Gitlab to Bitbucket. On Gitlab, we had a pipeline to build an app inside a Docker container and push it to Gitlab, and then deploy it to ECS.
I'm using docker service and the same script in Bitbucket pipelines (except for pushing to AWS ECR), but the final image seems to be different from the one built in Gitlab or locally. Consequently, it fails to start correctly after deployment.
Something seems to be going wrong with the AWS SDK and getcomposer installation.
Here's the relevant section of the dockerfile:
RUN apt-get update \
&& apt-get install --assume-yes -y git zip unzip \
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer require aws/aws-sdk-php \
&& rm -rf /var/lib/apt/lists/* /awscliv2.zip /aws /tmp/* /var/tmp/* /root/.composer
The command composer require aws/aws-sdk-php
should create the essential vendor
directory inside the working directory. I can see this directory when I build the image locally. However, the final image built using Bitbucket pipelines doesn't seem to have this directory, and I can't figure out why.
The only way to fix the app after deployment is to run this command again via SSH.
Could you please advice me with this issue?
Hi Anton and welcome to the community!
If I understand correctly, you are building a Docker image during a Pipelines build, from a Dockerfile that has the section you posted in your question?
If so, I haven't been able to reproduce so far the issue you are reporting. I used a Dockerfile with a base image I chose at random:
FROM php:8.3.0alpha2-zts-bullseye
WORKDIR /var
RUN apt-get update \
&& apt-get install --assume-yes -y git zip unzip \
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer require aws/aws-sdk-php \
&& rm -rf /var/lib/apt/lists/* /awscliv2.zip /aws /tmp/* /var/tmp/* /root/.composer
After building this in Pipelines and pushing it to a Docker registry, I can see the vendor directory inside /var if I start a container from this image.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.