mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
build: support building inside a container
This commit is contained in:
parent
735e8589f7
commit
2a96e73384
3 changed files with 39 additions and 5 deletions
7
Dockerfile
Normal file
7
Dockerfile
Normal 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
|
16
Makefile
16
Makefile
|
@ -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
|
||||
|
|
21
README.md
21
README.md
|
@ -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+
|
||||
|
|
Loading…
Reference in a new issue