0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

Merge pull request #11 from rchincha/gorilla-mux

build: support building inside a container
This commit is contained in:
Michael McCracken 2019-08-14 14:04:33 -07:00 committed by GitHub
commit 09301f17fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 5 deletions

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM golang:1.12.8
RUN go version
ENV GO111MODULE on
RUN go get -u github.com/swaggo/swag/cmd/swag
WORKDIR /go/src/github.com/anuvu/zot
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1

View file

@ -1,5 +1,7 @@
export GO111MODULE=on
TOP_LEVEL=$(shell git rev-parse --show-toplevel)
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
PATH := bin:$(PATH)
.PHONY: all
all: doc binary debug test check
@ -17,12 +19,10 @@ test:
$(shell cd test/data; ./gen_certs.sh; cd ${TOP_LEVEL})
go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...
./bin/golangci-lint:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1
.PHONY: check
check: ./bin/golangci-lint
./bin/golangci-lint run --enable-all ./cmd/... ./pkg/...
check:
golangci-lint --version || curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1
golangci-lint run --enable-all ./cmd/... ./pkg/...
.PHONY: doc
doc:
@ -36,3 +36,9 @@ clean:
.PHONY: run
run: binary test
./bin/zot serve examples/config-test.json
.PHONY: binary-container
binary-container:
${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile -t zot:latest .
${CONTAINER_RUNTIME} run --rm --security-opt label=disable -v $$(pwd):/go/src/github.com/anuvu/zot \
zot:latest make

View file

@ -9,6 +9,27 @@
* *Basic* and TLS mutual authentication
* Swagger based documentation
# Building
* Build inside a container (preferred)
```
make binary-container
```
* Build using host's toolchain
```
make
```
Build artifacts are in bin/
# Running
bin/zot serve _<config>_
# Caveats
* go 1.12+