-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6cdbcd
commit 71f168d
Showing
4 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# | ||
# Build the golang imageproxy application | ||
# | ||
FROM golang:1.12.6-alpine3.10 AS builder | ||
|
||
# Lets get some useful stiff for building | ||
RUN apk add --no-cache bash git openssh | ||
|
||
# Get the image proxy repo | ||
RUN go get willnorris.com/go/imageproxy/cmd/imageproxy | ||
|
||
# Double checking that the single binary is installed | ||
RUN ls -alh /go/bin | ||
|
||
# | ||
# Lets build the actual container | ||
# | ||
FROM alpine:latest | ||
|
||
# Lets add SSL support | ||
RUN apk --no-cache add ca-certificates | ||
|
||
# Copy over built file into bin | ||
WORKDIR /bin/ | ||
COPY --from=builder /go/bin/imageproxy . | ||
|
||
# Set workdir to /tmp/ | ||
WORKDIR /tmp/ | ||
|
||
# Debug checker | ||
RUN imageproxy --help || true | ||
|
||
# Default entry starts the server at port 80 | ||
ENTRYPOINT [ "imageproxy" ] | ||
CMD [ "-addr", "localhost:80" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
docker stop $(docker ps -a | grep $(basename "$PWD") | awk '{print $1}'); | ||
docker rm $(docker ps -a | grep $(basename "$PWD") | awk '{print $1}'); | ||
docker build -t $(basename "$PWD") . && | ||
docker run -d -P --name $(basename "$PWD") $(basename "$PWD"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Docker build process | ||
|
||
## inside the respective folder (eg: ./ssh/) | ||
docker build -t {tagname} . | ||
docker build -t $(basename "$PWD") . | ||
|
||
## running the build | ||
docker run -d -P --name {tagname} {container_name} | ||
docker run -d -P --name $(basename "$PWD") $(basename "$PWD") | ||
|
||
-d : detach mode | ||
-P : auto publish all ports | ||
-e : set env key=value pairs | ||
|
||
## adding listener port | ||
docker port containername XPortNum | ||
|
||
# Useful command chains | ||
|
||
## build, run | ||
docker build -t $(basename "$PWD") . && docker run -d -P --name $(basename "$PWD") $(basename "$PWD"); | ||
|
||
## nuke all, build, run | ||
docker rm $(docker ps -a -q); docker build -t $(basename "$PWD") . && docker run -d -P --name $(basename "$PWD") $(basename "$PWD"); | ||
|
||
## stop all, nuke all, build, run | ||
docker stop $(docker ps -aq); docker rm $(docker ps -a -q); docker build -t $(basename "$PWD") . && docker run -d -P --name $(basename "$PWD") $(basename "$PWD"); | ||
|
||
# Stop current "basename", Nuke it, Build it, Run it | ||
``` | ||
docker stop $(docker ps -a | grep $(basename "$PWD") | awk '{print $1}'); | ||
docker rm $(docker ps -a | grep $(basename "$PWD") | awk '{print $1}'); | ||
docker build -t $(basename "$PWD") . && | ||
docker run -d -P --name $(basename "$PWD") $(basename "$PWD"); | ||
``` | ||
|
||
Or as a single line | ||
|
||
`docker stop $(docker ps -a | grep $(basename "$PWD") | awk '{print $1}'); docker rm $(docker ps -a | grep $(basename "$PWD") | awk '{print $1}'); docker build -t $(basename "$PWD") . && docker run -d -P --name $(basename "$PWD") $(basename "$PWD");` | ||
|
||
# Docker commands | ||
|
||
## Delete all containers | ||
docker rm $(docker ps -a -q) | ||
## Delete all images | ||
docker rmi $(docker images -q) | ||
|
||
|
||
# ENTRYPOINT vs CMD | ||
|
||
- ENTRYPOINT is runs WITH cmd, | ||
- CMD is commonly overwritten by user | ||
- Technically user can overwrite ENTRYPOINT with additional command "flags" | ||
- Final executed command : ENTRYPOINT CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM node:12-alpine AS ui-build | ||
|
||
|
||
# # | ||
# # Build the golang imageproxy application | ||
# # | ||
# FROM golang:1.12.6-alpine3.10 AS builder | ||
|
||
# # Lets get some useful stiff for building | ||
# RUN apk add --no-cache bash git openssh | ||
|
||
# # Get the image proxy repo | ||
# RUN go get willnorris.com/go/imageproxy/cmd/imageproxy | ||
|
||
# # Double checking that the single binary is installed | ||
# RUN ls -alh /go/bin | ||
|
||
# # | ||
# # Lets build the actual container | ||
# # | ||
# FROM alpine:latest | ||
|
||
# # Lets add SSL support | ||
# RUN apk --no-cache add ca-certificates | ||
|
||
# # Copy over built file into bin | ||
# WORKDIR /bin/ | ||
# COPY --from=builder /go/bin/imageproxy . | ||
|
||
# # Set workdir to /tmp/ | ||
# WORKDIR /tmp/ | ||
|
||
# # Debug checker | ||
# RUN imageproxy --help || true | ||
|
||
# # Default entry starts the server at port 80 | ||
# ENTRYPOINT [ "imageproxy" ] | ||
# CMD [ "-addr", "localhost:80" ] |