Skip to content

Instantly share code, notes, and snippets.

@kekru
kekru / 01-dockerfile-stabilize-copy-cache.md
Last active Sep 27, 2020
Dockerfile: Stabilize build cache for COPY command, between different machines
View 01-dockerfile-stabilize-copy-cache.md

Dockerfile: Remote build cache optimization for COPY (on Windows)

With Docker (especially with Buildkit) you have the ability to share your images as build cache for other computers.

When running the following docker build command, Buildkit will download cache information from the images, referenced with --cache-from.

export IMAGE="my-registry.example.com/myproject/myapp:feature-1234"
export IMAGE_LATEST="my-registry.example.com/myproject/myapp:latest"
export DOCKER_BUILDKIT=1
@kekru
kekru / 01-gradle-execute-command.md
Last active Sep 19, 2020
Gradle execute command with environment variables and in other working dir
View 01-gradle-execute-command.md

Gradle: Execute command within dir and with env vars

This is how to create a run function in Gradle (Groovy) to execute a command in a selectable working directory and with additional environment variables.

It is based on groovy's String.execute(...)

build.gradle

@kekru
kekru / 01-Openshift3-WSL2.md
Last active Sep 12, 2020
Openshift 3.11 in WSL2
View 01-Openshift3-WSL2.md

Running Openshift 3.11 inside WSL2

This is not running yet, but nearly almost

Install WSL2 and oc client

First install a WSL2 with Ubuntu 20.04 as described at Microsoft

Enter wsl shell

@kekru
kekru / 01-docker-nginx-static-and-proxy-pass
Last active Sep 9, 2020
docker nginx static file and proxy pass
View 01-docker-nginx-static-and-proxy-pass
Simple Docker Setup for serving static files and proxy pass a path to a server
@kekru
kekru / process-file-locking-find.md
Last active Aug 13, 2020
Windows: Find process locking a file or directory
View process-file-locking-find.md

Find and stop process locking file on Windows

  • Download Handle
    or install with chocolatey:
    choco install -y handle
  • Print all file handles in a file:
    handle > handles.log
  • Find the process in handles.log (e.g example.exe) and stop it with Powershell:
    Stop-Process -Name example
@kekru
kekru / Dockerfile
Created Jul 28, 2020
gitlab-ci-pipelines-exporter on alpine
View Dockerfile
FROM alpine:3.9.6
COPY --from=mvisonneau/gitlab-ci-pipelines-exporter:0.2.14 /usr/local/bin/gitlab-ci-pipelines-exporter /usr/local/bin/
RUN apk add --no-cache ca-certificates
USER 65534
EXPOSE 8080
@kekru
kekru / 1-WSL and Docker for Windows.md
Last active May 30, 2020
Windows 10 Subsystem for Linux combined with Docker for Windows
View 1-WSL and Docker for Windows.md

Using Windows Subsystem for Linux combined with Docker for Windows

Docker CE for Windows

  • Install Docker CE for Windows
  • Go to Docker for Windows Settings -> General and enable Expose daemon on tcp://localhost:2375 without TLS.
    This will enable the Docker remote API for requests, coming from localhost, not from another computer in your network. A TLS secured version is not yet supported in Docker for Windows. See https://github.com/docker/for-win/issues/453 for more information. I also tried a daemon.json file with options tlscacert, tlscert, tlskey and tlsverify, but Docker for Windows crashed on booting.

Install Windows Subsystem for Linux (WSL)

@kekru
kekru / git-copy-files-to-empty-branch.md
Last active May 21, 2020
git: Copy files to new branch without history, using a squash merge
View git-copy-files-to-empty-branch.md

Git: New branch with files but no history

This is how to copy your files from a given git branch to a new empty branch, using a squash merge.
This example will copy files from branch old-branch to target-branch

# First be sure, that you don't have uncommitted working changes. They will be deleted

# Checkout a new empty branch without history
git checkout --orphan target-branch
@kekru
kekru / Springboot.Dockerfile
Last active Jan 6, 2020
Spring Boot Dockerfile template
View Springboot.Dockerfile
FROM openjdk:8-jre
RUN echo "Europe/Berlin" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
RUN mkdir /data
WORKDIR /data
ADD myapp.jar /data/myapp.jar
ENV springprofiles="" \
MAXRAMIFNOLIMIT=4096
ENTRYPOINT MAXRAM=$(expr `cat /sys/fs/cgroup/memory/memory.limit_in_bytes` / 1024 / 1024) && \
You can’t perform that action at this time.