├── .editorconfig ├── .gitattributes ├── .gitignore ├── Dockerfile ├── License.md ├── README.md ├── run.bat └── src └── app.go /.editorconfig: -------------------------------------------------------------------------------- 1 | ; editor configuration powered by http://editorconfig.org/ 2 | ; Top-most EditorConfig file 3 | root = true 4 | 5 | ; Windows newlines 6 | [*] 7 | end_of_line = crlf 8 | indent_style = space 9 | indent_size = 4 10 | 11 | [*.sh] 12 | end_of_line = lf 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Trunk/ 2 | bin/ 3 | obj/ 4 | .vs 5 | docker-compose.generated.yml 6 | src/app 7 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Create a build image 2 | FROM golang:1.8 as build 3 | WORKDIR /go/src 4 | COPY src/app.go . 5 | RUN go build -v -o app 6 | 7 | # Create a run image 8 | FROM scratch 9 | WORKDIR /root/ 10 | # Copy the file from the build image 11 | COPY --from=build /go/src/app . 12 | CMD ["./app"] 13 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2017 Aaron Powell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker, FROM scratch 2 | 3 | This repo contains a series of exercises for the talk, [Docker, FROM scratch](https://www.aaron-powell.com/talks/docker-from-scratch/). 4 | 5 | [![Video](https://img.youtube.com/vi/RBnPvQQ36mA/hqdefault.jpg)](https://www.youtube.com/watch?v=RBnPvQQ36mA) 6 | -------------------------------------------------------------------------------- /run.bat: -------------------------------------------------------------------------------- 1 | ECHO OFF 2 | 3 | ECHO Building app 4 | 5 | docker build -t dfs-scratch --rm . 6 | 7 | ECHO Running container 8 | 9 | docker run --rm dfs-scratch 10 | 11 | docker image ls 12 | 13 | docker rmi dfs-scratch 14 | docker image prune -f -------------------------------------------------------------------------------- /src/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | fmt.Println("Hello, everyone") 7 | fmt.Println("I'm a Go app running from a scratch Docker container") 8 | } 9 | --------------------------------------------------------------------------------