Skip to content

Instantly share code, notes, and snippets.

View kyle-morton's full-sized avatar

Kyle Morton kyle-morton

View GitHub Profile
@kyle-morton
kyle-morton / docker-compose.md
Last active August 18, 2020 02:41
Docker Compose

Docker Compose

Features

  • manages the whole app lifecycle -- start, stop, and rebuilding services -- view status of running services -- stream the log output of running services -- run a one-off command on a service
@kyle-morton
kyle-morton / docker-container-linking.md
Created August 18, 2020 02:13
Docker Container Linking

Container Linking

  • this is very useful if you have an app image that needs to communicate w/ 1 or more other containers (things like a web server, database(s), other app servers, etc)

Linking containers by name (legacy linking)

Steps

  1. Run container w/ a name using cmd line switch
@kyle-morton
kyle-morton / dev.Dockerfile
Created August 15, 2020 19:51
Development dockerfile
FROM mcr.microsoft.com/dotnet/core/sdk
LABEL key="Kyle Morton"
ENV ASPNETCORE_URLS=http://*:5000
ENV DOTNET_USE_POLLING_FILE_WATCHER=1
ENV ASPNETCORE_ENVIRONMENT=development
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1909 AS base
WORKDIR /app
EXPOSE 5000
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1909 AS build
WORKDIR /src
COPY ["docker-mvc.csproj", "./"]
RUN dotnet restore "./docker-mvc.csproj"
COPY . .
WORKDIR "/src/."
@kyle-morton
kyle-morton / dockerfile-notes.md
Last active August 15, 2020 20:02
Dockerfile Notes

Dockerfile

Dockerfiles represent a way to create an image w/ a layered file system using 1 or more existing images along w/ steps to build/copy files and dependencies.

Creating a customer ASP.NET Core Dockerfile

Easy way to autogenerate a production ready .dockerfile in VS Code -

  1. open project folder in vscode
  2. install both the docker & C# (omnisharp) extensions

Key Docker Commands

IMAGES

docker pull [image-name]

  • pull image onto machine

docker images

  • list images on your machine
var strCmdText = "/C youtube-dl -i --extract-audio --audio-format mp3 --audio-quality 0 {YOUTUBE_URL};
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
@kyle-morton
kyle-morton / swift-optionals.swift
Created June 25, 2019 18:56
small playground used to learn about swift optionals and syntax
import UIKit
var str = "Hello, playground"
func sayTitle(title: String) {
print("Title: \(title)")
}
class Movie {
var title: String?