Skip to content

Instantly share code, notes, and snippets.

View MnifR's full-sized avatar
🎯
Focusing

Raouf MnifR

🎯
Focusing
View GitHub Profile
@MnifR
MnifR / Dockerfile
Last active February 18, 2020 09:22
Dockerfile
# stage1 as builder
FROM node:lts-alpine as builder
# copy the package.json to install dependencies
COPY package.json package-lock.json ./
# Install the dependencies and make the folder
RUN npm install && mkdir /react-ui && mv ./node_modules ./react-ui
WORKDIR /react-ui
@MnifR
MnifR / Jenkinsfile
Created March 17, 2020 10:10 — forked from oifland/Jenkinsfile
Loops in Jenkinsfiles
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
@MnifR
MnifR / Jenkinsfile
Created April 10, 2020 17:06 — forked from sambott/Jenkinsfile
Example Jenkinsfile
#!groovy
String GIT_VERSION
node {
def buildEnv
def devAddress
stage ('Checkout') {
@MnifR
MnifR / Jenkinsfile
Created April 10, 2020 17:06 — forked from bvis/Jenkinsfile
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
@MnifR
MnifR / docker-user-remap.sh
Last active November 2, 2022 22:48
docker’s userns-remap feature allows us to use a default dockremap user. In this scenario, docker engine creates the user dockremap on the host and maps the root user inside a container to this user. For this user, docker also needs to have entries on the host’s /etc/subuid and /etc/subgid files.
#!/bin/bash
###############################################################
# Docker userns-remap and system users on Linux
###############################################################
groupadd -g 500000 dockremap &&
groupadd -g 501000 dockremap-user &&
useradd -u 500000 -g dockremap -s /bin/false dockremap &&
@MnifR
MnifR / gitlab-cleaning.sh
Created May 27, 2020 16:38
Gitlab omnibus cleaning registry
wget https://gitlab.com/gitlab-org/docker-distribution-pruner/-/jobs/142025596/artifacts/raw/docker-distribution-pruner
EXPERIMENTAL=true ./docker-distribution-pruner -config=/var/opt/gitlab/registry/config.yml -delete -soft-delete=false -soft-errors
@MnifR
MnifR / gitlab-migrate.sh
Created May 27, 2020 16:48
Gitlab Migration
gitlab-rails dbconsole
UPDATE projects SET runners_token = null, runners_token_encrypted = null;
UPDATE application_settings SET runners_registration_token_encrypted = null;
UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
UPDATE ci_runners SET token = null, token_encrypted = null;
UPDATE ci_builds SET token = null, token_encrypted = null;
@MnifR
MnifR / docker-volume-backup.sh
Created May 27, 2020 16:57
docker volume backup
docker run --rm -v myvolume:/tmp/src -v /tmp/:/tmp/dest -u root alpine tar -czvf /tmp/dest/mybackup.tar.gz /tmp/src/
docker run -v myvolume:/volume -v /tmp:/backup --rm loomchild/volume-backup backup my-volume
docker run -v myvolume:/volume -v /tmp:/backup --rm loomchild/volume-backup restore my-volume
@MnifR
MnifR / nginx_deployment.yaml
Created May 27, 2020 17:58 — forked from petitviolet/nginx_deployment.yaml
sample Nginx configuration on Kubernetes using ConfigMap to configure nginx.
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
events {
@MnifR
MnifR / Jenkinsfile
Created May 27, 2020 18:12 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples