Sign inSign up

laramatics/gitlab-ci

By laramatics

•Updated over 1 year ago

A lightweight Laravel Gitlab CI docker image based on Alpine

Image
1

6.3K

laramatics/gitlab-ci repository overview

⁠Laravel Gitlab-CI

GitHub Docker Image Size (tag) Docker Pulls Docker Image Version (latest semver) Docker Cloud Automated build Docker Cloud Build Status

⁠About

A Dockerfile for building an image⁠ for your Laravel app Gitlab CI/CD pipelines.

⁠Table of Contents

⁠Folder Structure

Although folder structure is self-explanatory, description is as below:

.
├── Dockerfile
├── LICENSE
├── readme.md
├── scripts
│   ├── cleanup.sh            # Removes build dependencies for lighter image size.
│   ├── install-node-yarn.sh  # Install your global npm/yarn packages here.
│   ├── install-packages.sh   # OS packages will be installed by this file.
│   └── install-php.sh        # PHP extensions and installation.
└── tests
    └── goss.yaml             # See "testing" section

⁠Packages and Services

We created the Dockerfile with image size in mind, only packages and PHP extensions which are absolutely necessary are installed.

ServiceVersionArgument
PHP8.0.1PHP_VERSION
Composer2.0.9COMPOSER_VERSION
Node15.7.0NODE_VERSION
NPM7.5.2NPM_VERSION
reg⁠latestN/A
cfcli⁠latestN/A
local-php-security-checker⁠latestN/A
⁠Customizing build versions

As you can see in the table above, some services have an argument in Dockerfile for you to modify the installation version. To do so, you need to clone the repo and build the image yourself:

git clone https://github.com/laramatics/gitlab-ci.git
cd gitlab-ci
# Modify files...
docker build \
  --build-arg NPM_VERSION=7.5.2 \
  --build-arg PHP_VERSION=8.0.1 \
  -t <image_name> .
⁠Adding more PHP extensions

If you want to add more extensions to the PHP installation, you will have to build your own image based on the one already built or modify the Dockerfile and scripts/* to your liking and build your own image from it⁠.

See Docker PHP Extension Installer⁠ for available extensions, alternatively you can install them fom source.

FROM laramatics/gitlab-ci:latest
# Add your extentions here...
RUN docker-php-ext-install -j "$(nproc)" <package_name>
⁠Adding more packages

Sometimes you need a specific package for your pipeline; as described in the previous section, you can build your own image from laramatics/gitlab-ci or clone this repo and modify files to suit your needs.

git clone https://github.com/laramatics/gitlab-ci.git
cd gitlab-ci
# Modify files...
docker build -t <image_name> .
⁠Testing

Tests are written using GOSS⁠, to test your changes after modifying source files and building your own image, run:

GOSS_FILES_PATH=tests dgoss run -it <image_name>

⁠References

Tag summary

Content type

Image

Digest

sha256:1c58a13b2…

Size

172 MB

Last updated

over 1 year ago

docker pull laramatics/gitlab-ci