Add Dockerfile

This commit is contained in:
Jay Gabriels
2022-03-05 09:42:07 -08:00
parent c3a7e10843
commit d4680cb463
3 changed files with 31 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
## [1.7.12] - unreleased
### Added
- Dockerfile
### Changed
### Deprecated
### Removed

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM golang:alpine
# Install dependencies for copy
RUN apk add -U --no-cache ca-certificates tzdata git
WORKDIR /go/src/github.com/gabrie30/ghorg
COPY . .
# Fetching dependencies and build the app
RUN go get -d -v ./...
RUN CGO_ENABLED=0 go build -a --mod vendor -o ghorg .

View File

@@ -95,6 +95,25 @@ go install github.com/gabrie30/ghorg@latest
go get github.com/gabrie30/ghorg
```
### Docker
> This is only recommended for testing due to resource constraints
1. Clone repo then `cd ghorg`
1. Build the image `docker build . -t ghorg-docker`
1. Run in docker
```bash
# Using your local ghorg configuration file, cloning in container
docker run -v $HOME/.config/ghorg/conf.yaml:/root/.config/ghorg/conf.yaml ghorg-docker ./ghorg clone kubernetes
# Using flags, cloning in container
docker run ghorg-docker ./ghorg clone kubernetes --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2
# Using flags, cloning to your machine
docker run -v $HOME/ghorg/:/root/ghorg/ ghorg-docker ./ghorg clone kubernetes --token=bGVhdmUgYSBjb21tZW50IG9uIGlzc3VlIDY2 --output-dir=cloned-from-docker
```
## Use
```bash