Commit 2d8ea343 authored by Camilo Tapia's avatar Camilo Tapia
Browse files

Merge branch 'feature/docker-executor-runner' into 'master'

New Docker executor runner

See merge request !1
parents c2e8946b e9980958
Pipeline #14399 passed with stage
in 4 minutes and 25 seconds
......@@ -5,8 +5,9 @@ before_script:
- export TERM=xterm-256color
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry2.24hr.se
build-content:
build-images:
stage: build
script:
- make publish
only:
- master
VERSION := $(shell cat ./version.txt)
REGISTRY=registry2.24hr.se
SERVICE_NAME=gitlab-runners/node-aws-runner
SERVICE_RELEASE=$(VERSION)
SERVICE_VERSION_LATEST=latest
TAG_NAME=$(SERVICE_NAME):$(SERVICE_RELEASE)
TAG_NAME_LATEST=$(SERVICE_NAME):$(SERVICE_VERSION_LATEST)
build:
@echo "Building version $(REGISTRY)/$(SERVICE_NAME):$(SERVICE_RELEASE)"
docker build --build-arg VERSION="$(VERSION)" --rm=true -t $(TAG_NAME) -f Dockerfile .
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME)
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME_LATEST)
@echo ""
@echo "Done building."
@echo ""
publish:
$(MAKE) build
echo "Pushing $(TAG_NAME)"
docker push $(REGISTRY)/$(TAG_NAME)
docker push $(REGISTRY)/$(TAG_NAME_LATEST)
echo "Done."
echo ""
cd docker-executor/runner && $(MAKE) publish
cd docker-executor/default-image && $(MAKE) publish
cd shell-executor && $(MAKE) publish
\ No newline at end of file
version: '2.1'
services:
runner:
shell-runner:
image: registry2.24hr.se/gitlab-runners/node-aws-runner:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
......@@ -9,3 +9,10 @@ services:
- GITLAB_URL=https://gitlab.24hr.se
- GITLAB_RUNNER_TOKEN=${GITLAB_RUNNER_TOKEN}
- GITLAB_RUNNER_DESCRIPTION="24HR Gitlab Shared Runner 004"
docker-runner:
image: registry2.24hr.se/gitlab-runners/node-aws-runner/docker:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- GITLAB_URL=https://gitlab.24hr.se
- GITLAB_RUNNER_TOKEN=${GITLAB_RUNNER_TOKEN}
FROM node:16-buster
RUN apt-get update
RUN apt-get install rsync build-essential wget -y
# Install AWS CLI
RUN apt-get install python3 python3-pip -y
RUN pip3 install awscli --upgrade --user
RUN ln -s ~/.local/bin/aws /usr/local/bin/aws
# Install kubectl
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/bin/kubectl
WORKDIR /app
\ No newline at end of file
VERSION := $(shell cat ./version.txt)
REGISTRY=registry2.24hr.se
SERVICE_NAME=gitlab-runners/node-aws-runner/docker-default-image
SERVICE_RELEASE=$(VERSION)
SERVICE_VERSION_LATEST=latest
TAG_NAME=$(SERVICE_NAME):$(SERVICE_RELEASE)
TAG_NAME_LATEST=$(SERVICE_NAME):$(SERVICE_VERSION_LATEST)
build:
@echo "Building version $(REGISTRY)/$(SERVICE_NAME):$(SERVICE_RELEASE)"
docker build --build-arg VERSION="$(VERSION)" --rm=true -t $(TAG_NAME) -f Dockerfile .
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME)
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME_LATEST)
@echo ""
@echo "Done building."
@echo ""
publish:
$(MAKE) build
echo "Pushing $(TAG_NAME)"
docker push $(REGISTRY)/$(TAG_NAME)
docker push $(REGISTRY)/$(TAG_NAME_LATEST)
echo "Done."
echo ""
0.0.1
\ No newline at end of file
FROM gitlab/gitlab-runner:latest
COPY ./start.sh /start.sh
CMD ["./start.sh"]
VERSION := $(shell cat ./version.txt)
REGISTRY=registry2.24hr.se
SERVICE_NAME=gitlab-runners/node-aws-runner/docker
SERVICE_RELEASE=$(VERSION)
SERVICE_VERSION_LATEST=latest
TAG_NAME=$(SERVICE_NAME):$(SERVICE_RELEASE)
TAG_NAME_LATEST=$(SERVICE_NAME):$(SERVICE_VERSION_LATEST)
build:
@echo "Building version $(REGISTRY)/$(SERVICE_NAME):$(SERVICE_RELEASE)"
docker build --build-arg VERSION="$(VERSION)" --rm=true -t $(TAG_NAME) -f Dockerfile .
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME)
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME_LATEST)
@echo ""
@echo "Done building."
@echo ""
publish:
$(MAKE) build
echo "Pushing $(TAG_NAME)"
docker push $(REGISTRY)/$(TAG_NAME)
docker push $(REGISTRY)/$(TAG_NAME_LATEST)
echo "Done."
echo ""
#!/bin/bash
gitlab-runner register -n \
--url $GITLAB_URL \
--registration-token $GITLAB_RUNNER_TOKEN \
--executor docker \
--docker-image "registry2.24hr.se/gitlab-runners/node-aws-runner/docker-default-image:${GITLAB_RUNNER_DEFAULT_IMAGE:-latest}" \
--description "Let's you run Docker images in your jobs by specifying the \"image\" property in CI config." \
--tag-list "docker" \
--locked false
VERSION := $(shell cat ./version.txt)
REGISTRY=registry2.24hr.se
SERVICE_NAME=gitlab-runners/node-aws-runner
SERVICE_RELEASE=$(VERSION)
SERVICE_VERSION_LATEST=latest
TAG_NAME=$(SERVICE_NAME):$(SERVICE_RELEASE)
TAG_NAME_LATEST=$(SERVICE_NAME):$(SERVICE_VERSION_LATEST)
build:
@echo "Building version $(REGISTRY)/$(SERVICE_NAME):$(SERVICE_RELEASE)"
docker build --build-arg VERSION="$(VERSION)" --rm=true -t $(TAG_NAME) -f Dockerfile .
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME)
docker tag $(TAG_NAME) $(REGISTRY)/$(TAG_NAME_LATEST)
@echo ""
@echo "Done building."
@echo ""
publish:
$(MAKE) build
echo "Pushing $(TAG_NAME)"
docker push $(REGISTRY)/$(TAG_NAME)
docker push $(REGISTRY)/$(TAG_NAME_LATEST)
echo "Done."
echo ""
......@@ -9,5 +9,3 @@ gitlab-runner register -n \
--executor shell \
--description "$GITLAB_RUNNER_DESCRIPTION" \
--locked false
gitlab-runner run
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment