https://github.com/verdverm/discworld
Docker build in any Docker container with two simple aliases.
https://github.com/verdverm/discworld
bash-alias discworld docker docker-container hacks
Last synced: 15 days ago
JSON representation
Docker build in any Docker container with two simple aliases.
- Host: GitHub
- URL: https://github.com/verdverm/discworld
- Owner: verdverm
- Created: 2016-03-18T16:00:36.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-12T22:17:41.000Z (about 10 years ago)
- Last Synced: 2025-10-11T03:34:16.102Z (7 months ago)
- Topics: bash-alias, discworld, docker, docker-container, hacks
- Language: Shell
- Homepage:
- Size: 57.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# discworld
Docker build in any Docker container

This is useful for having containers with your build tools
and then creating a runtime container for your application
which is not polluted with the build tools and source code.
`alias itsWhalesAllTheWayDown='docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) '`
Launch your builder and run bash.
`itsWhalesAllTheWayDown --rm -it -v $(pwd):/myapp myapp-builder /bin/bash`
Or if you have a build script as the ENTRYPOINT
`itsWhalesAllTheWayDown -d -v $(pwd):/myapp myapp-builder ...args to your script...`
Now run your docker commands from within the docker container you are running.
It will talk to the external docker-daemon and build your image externally.
Installation
----------------
Add the alias to your `.profile`, `.bash_profile`, or `.bashrc`
Minimal Golang Docker Image
---------------------------
`docker build -t golang-dockerizer .`
*this may be broken right now*
`alias itsGophersAllTheWayDown='itsWhalesAllTheWayDown -e "APPDIR=$(pwd)" -e "EXTERNAL_GOPATH=$GOPATH" -v $(pwd):$(pwd)) --rm -it golang-dockerizer'`
In your Golang project directory, create a Dockerfile like this:
```
FROM scratch
ADD GoappBinary /GoappBinary
ENTRYPOINT ["/GoappBinary"]
# include any other docker stuff you'd like
# ADD src/www /www
# EXPOSE 8080
# VOLUME /path/to/dir
```
Then run
`itsGophersAllTheWayDown `
This will produce a Docker image with just your Golang app.
-- Image courtesy of https://ferrebeekeeper.files.wordpress.com/2015/03/discworld.jpg --