Skip to content

Instantly share code, notes, and snippets.

View mthalman's full-sized avatar

Matt Thalman mthalman

View GitHub Profile
@mthalman
mthalman / README.md
Created April 21, 2024 20:31
mthalman Docker ecosystem
flowchart TD
    A(docker-bump-action) -->B(dredge)
    A-->C(dockerfile-spy)
    B-->D(docker-creds-provider)
    B-->F(docker-registry-client)
    B-->E(dockerfile-model)
    C-->E
@mthalman
mthalman / Dockerfile.md
Created April 12, 2024 00:54
Chiseled PowerShell
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS installer

RUN mkdir /pwsh-symlink \
    && ln -s /usr/share/powershell/pwsh /pwsh-symlink/pwsh

FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled

COPY --from=installer /usr/share/powershell /usr/share/powershell
COPY --from=installer ["/pwsh-symlink", "/usr/bin"]
@mthalman
mthalman / readme.md
Created February 3, 2023 16:54
Get core dump from container
docker run --name test1 -it --entrypoint /bin/sh --privileged <image-name>

In Container:

echo "/cores/core" | tee /proc/sys/kernel/core_pattern
mkdir /cores
ulimit -c unlimited
@mthalman
mthalman / readme.md
Created October 27, 2022 16:17
Check if image is built on latest base image

Linux

myImage="<insert-my-image-digest>"
baseImage="<insert-base-image-tag>"

function isBuiltOnLatestBaseImage() {
    echo "Pulling $myImage"
    docker pull $myImage
@mthalman
mthalman / tips.md
Last active July 18, 2022 11:09
Developer Productivity Tips

Developer Productivity Tips

Time management

  • Limit the amount of context switching you do, it can lead to mistakes all around
  • Queue non-urgent tasks for when you have down time
  • Block off time in calendar to focus on a task
  • Take breaks

Task management

@mthalman
mthalman / get-dependencies.sh
Last active December 3, 2021 19:15
Get package dependencies of derived container image
#!/usr/bin/env bash
# Outputs the set of packages that are dependencies of the packages added by a derived container image.
baseTag="debian:buster-slim"
derivedTag="mcr.microsoft.com/dotnet/aspnet:3.1"
containerCmd="apt list --installed 2>/dev/null | grep installed | sed -n 's/^\([^/]*\).*/\1/p' | sort"
deltaPkgs=$(comm -13 <(docker run --rm $baseTag /bin/sh -c "$containerCmd") <(docker run --rm $derivedTag /bin/sh -c "$containerCmd") | tr '\n' ' ')
@mthalman
mthalman / DotNetTheoryAttribute.cs
Created February 1, 2021 21:41
Skip tests for empty theory data
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Xunit;
using Xunit.Sdk;
namespace Microsoft.DotNet.Docker.Tests
{
[XunitTestCaseDiscoverer("Microsoft.DotNet.Docker.Tests.DotNetTheoryDiscoverer", "Microsoft.DotNet.Docker.Tests")]
@mthalman
mthalman / MainPage.xaml
Created June 6, 2019 10:24
UWP TreeView Performance Issue
<Page
x:Class="App.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">