mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +00:00
Merge branch 'reworking-dockerfile'
This commit is contained in:
commit
a7ccf40d3f
6 changed files with 155 additions and 13 deletions
12
.dockerignore
Normal file
12
.dockerignore
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
.circleci
|
||||
.github
|
||||
docs
|
||||
test
|
||||
.gitignore
|
||||
.goreleaser.yml
|
||||
*.md
|
||||
coverage.txt
|
||||
Dockerfile
|
||||
LICENSE
|
||||
test.sh
|
||||
.git
|
||||
58
Dockerfile
58
Dockerfile
|
|
@ -1,15 +1,49 @@
|
|||
# run with:
|
||||
# docker build -t lazydocker .
|
||||
# docker run -it lazydocker:latest /bin/sh -l
|
||||
ARG BASE_IMAGE_BUILDER=golang
|
||||
ARG ALPINE_VERSION=3.10
|
||||
ARG GO_VERSION=1.12.6
|
||||
|
||||
FROM golang:alpine
|
||||
WORKDIR /go/src/github.com/jesseduffield/lazydocker/
|
||||
FROM ${BASE_IMAGE_BUILDER}:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
|
||||
ARG GOARCH=amd64
|
||||
ARG GOARM
|
||||
ARG VERSION
|
||||
ARG VCS_REF
|
||||
WORKDIR /tmp/gobuild
|
||||
COPY ./ .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} GOARM=${GOARM} \
|
||||
go build -a -mod=vendor \
|
||||
-ldflags="-s -w \
|
||||
-X main.commit=${VCS_REF} \
|
||||
-X main.version=${VERSION} \
|
||||
-X main.buildSource=Docker"
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk add -U git xdg-utils
|
||||
WORKDIR /go/src/github.com/jesseduffield/lazydocker/
|
||||
COPY --from=0 /go/src/github.com/jesseduffield/lazydocker /go/src/github.com/jesseduffield/lazydocker
|
||||
COPY --from=0 /go/src/github.com/jesseduffield/lazydocker/lazydocker /bin/
|
||||
RUN echo "alias gg=lazydocker" >> ~/.profile
|
||||
FROM ${BASE_IMAGE_BUILDER}:${GO_VERSION}-alpine${ALPINE_VERSION} AS docker-builder
|
||||
ARG GOARCH=amd64
|
||||
ARG GOARM
|
||||
ARG DOCKER_VERSION=v18.09.7
|
||||
RUN apk add -U -q --progress --no-cache git bash coreutils gcc musl-dev
|
||||
WORKDIR /go/src/github.com/docker/cli
|
||||
RUN git clone --branch ${DOCKER_VERSION} --single-branch --depth 1 https://github.com/docker/cli.git . > /dev/null 2>&1
|
||||
ENV CGO_ENABLED=0 \
|
||||
GOARCH=${GOARCH} \
|
||||
GOARM=${GOARM} \
|
||||
DISABLE_WARN_OUTSIDE_CONTAINER=1
|
||||
RUN ./scripts/build/binary
|
||||
RUN rm build/docker && mv build/docker-linux-* build/docker
|
||||
|
||||
FROM scratch
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
ARG VERSION
|
||||
LABEL \
|
||||
org.opencontainers.image.authors="jessedduffield@gmail.com" \
|
||||
org.opencontainers.image.created=$BUILD_DATE \
|
||||
org.opencontainers.image.version=$VERSION \
|
||||
org.opencontainers.image.revision=$VCS_REF \
|
||||
org.opencontainers.image.url="https://github.com/jesseduffield/lazydocker" \
|
||||
org.opencontainers.image.documentation="https://github.com/jesseduffield/lazydocker" \
|
||||
org.opencontainers.image.source="https://github.com/jesseduffield/lazydocker" \
|
||||
org.opencontainers.image.title="lazydocker" \
|
||||
org.opencontainers.image.description="The lazier way to manage everything docker"
|
||||
ENTRYPOINT [ "/bin/lazydocker" ]
|
||||
COPY --from=docker-builder /go/src/github.com/docker/cli/build/docker /bin/docker
|
||||
COPY --from=builder /tmp/gobuild/lazydocker /bin/lazydocker
|
||||
75
README.md
75
README.md
|
|
@ -73,6 +73,81 @@ makepkg --install
|
|||
|
||||
A development version of the AUR package is also [available](https://aur.archlinux.org/lazydocker-git.git)
|
||||
|
||||
### Docker
|
||||
|
||||
[](https://hub.docker.com/r/lazyteam/lazydocker)
|
||||
[](https://hub.docker.com/r/lazyteam/lazydocker)
|
||||
[](https://hub.docker.com/r/lazyteam/lazydocker)
|
||||
|
||||
1. <details><summary>Click if you have an ARM device</summary><p>
|
||||
|
||||
- If you have a ARM 32 bit v6 architecture
|
||||
|
||||
```sh
|
||||
docker build -t lazyteam/lazydocker \
|
||||
--build-arg BASE_IMAGE_BUILDER=arm32v6/golang \
|
||||
--build-arg GOARCH=arm \
|
||||
--build-arg GOARM=6 \
|
||||
https://github.com/jesseduffield/lazydocker.git
|
||||
```
|
||||
|
||||
- If you have a ARM 32 bit v7 architecture
|
||||
|
||||
```sh
|
||||
docker build -t lazyteam/lazydocker \
|
||||
--build-arg BASE_IMAGE_BUILDER=arm32v7/golang \
|
||||
--build-arg GOARCH=arm \
|
||||
--build-arg GOARM=7 \
|
||||
https://github.com/jesseduffield/lazydocker.git
|
||||
```
|
||||
|
||||
- If you have a ARM 64 bit v8 architecture
|
||||
|
||||
```sh
|
||||
docker build -t lazyteam/lazydocker \
|
||||
--build-arg BASE_IMAGE_BUILDER=arm64v8/golang \
|
||||
--build-arg GOARCH=arm64 \
|
||||
https://github.com/jesseduffield/lazydocker.git
|
||||
```
|
||||
|
||||
</p></details>
|
||||
|
||||
1. Run the container
|
||||
|
||||
```sh
|
||||
docker run -it -v \
|
||||
/var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /yourpath:/.config/jesseduffield/lazydocker \
|
||||
lazyteam/lazydocker
|
||||
```
|
||||
|
||||
- Don't forget to change `/yourpath` to an actual path you created to store lazydocker's config
|
||||
- You can also use this [docker-compose.yml](https://github.com/jesseduffield/lazydocker/blob/master/docker-compose.yml)
|
||||
- You might want to create an alias, for example:
|
||||
|
||||
```sh
|
||||
echo "alias ld='docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v /yourpath/config:/.config/jesseduffield/lazydocker lazyteam/lazydocker'" >> ~/.zshrc
|
||||
```
|
||||
|
||||
|
||||
|
||||
For development, you can build the image using:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/jesseduffield/lazydocker.git
|
||||
cd lazydocker
|
||||
docker build -t lazyteam/lazydocker \
|
||||
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
|
||||
--build-arg VCS_REF=`git rev-parse --short HEAD` \
|
||||
--build-arg VERSION=`git describe --abbrev=0 --tag` \
|
||||
.
|
||||
```
|
||||
|
||||
If you encounter a compatibility issue with Docker bundled binary, try rebuilding
|
||||
the image with the build argument `--build-arg DOCKER_VERSION="v$(docker -v | cut -d" " -f3 | rev | cut -c 2- | rev)"`
|
||||
so that the bundled docker binary matches your host docker binary version.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Call `lazydocker` in your terminal. I personally use this a lot so I've made an alias for it like so:
|
||||
|
|
|
|||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
version: '3'
|
||||
services:
|
||||
lazydocker:
|
||||
build:
|
||||
context: https://github.com/jesseduffield/lazydocker.git
|
||||
args:
|
||||
BASE_IMAGE_BUILDER: golang
|
||||
GOARCH: amd64
|
||||
GOARM:
|
||||
image: jesseduffield/lazydocker
|
||||
container_name: lazydocker
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./config:/.config/jesseduffield/lazydocker
|
||||
6
hooks/build
Normal file
6
hooks/build
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
|
||||
--build-arg VCS_REF=`git rev-parse --short HEAD` \
|
||||
--build-arg VERSION=`git describe --abbrev=0 --tag` \
|
||||
-t $IMAGE_NAME .
|
||||
|
|
@ -52,7 +52,6 @@ func NewApp(config *config.AppConfig) (*App, error) {
|
|||
|
||||
func (app *App) Run() error {
|
||||
err := app.Gui.RunWithSubprocesses()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue