GitLab

.gitlab-ci.yml

stages:
  - build

build:
  stage: build
  image: docker:stable
  services:
    - docker:dind
  before_script:
    - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
    - echo "$CI_REGISTRY_USER $CI_REGISTRY"
  script:
    - echo "$NPMRC" > .npmrc && sed -i 's/\r /\n/g' .npmrc && cat .npmrc
    - export PROJECT_NAME=$(echo ${CI_PROJECT_NAME} | awk '{print tolower($0)}')
    - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_BRANCH --build-arg BRANCH=$CI_COMMIT_BRANCH .
    - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$PROJECT_NAME
  only:
    - dev
    - main

Dockerfile

FROM registry.gitlab.com/cloudmonitor/images/laravel:latest
ARG BRANCH=main
ARG NPMRC=
COPY . .
RUN sh /install
Emil Moe

Software- and Data Engineer

I created this website to help you empower your infrastructure and so you don't need to spend the same amount of hours as me on researching. I chose to make the site ad-free, so if you like what I do, please consider supporting my Patreon.

Leave a Reply

Your email address will not be published. Required fields are marked *