mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
deployment/docker: allow building docker images on top of any base image set via ROOT_IMAGE environment var
For example, the following command will build VictoriaMetrics docker image on top of alpine image: ROOT_IMAGE=alpine make package-victoria-metrics
This commit is contained in:
parent
2de76bca96
commit
851946af1e
@ -559,6 +559,13 @@ Run `make package-victoria-metrics`. It builds `victoriametrics/victoria-metrics
|
|||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-victoria-metrics`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-victoria-metrics`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-victoria-metrics
|
||||||
|
```
|
||||||
|
|
||||||
### Start with docker-compose
|
### Start with docker-compose
|
||||||
|
|
||||||
[Docker-compose](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/docker-compose.yml)
|
[Docker-compose](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/docker-compose.yml)
|
||||||
|
@ -224,3 +224,10 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic
|
|||||||
Run `make package-vmagent`. It builds `victoriametrics/vmagent:<PKG_TAG>` docker image locally.
|
Run `make package-vmagent`. It builds `victoriametrics/vmagent:<PKG_TAG>` docker image locally.
|
||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmagent`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmagent`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-vmagent
|
||||||
|
```
|
||||||
|
@ -179,3 +179,10 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic
|
|||||||
Run `make package-vmbackup`. It builds `victoriametrics/vmbackup:<PKG_TAG>` docker image locally.
|
Run `make package-vmbackup`. It builds `victoriametrics/vmbackup:<PKG_TAG>` docker image locally.
|
||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmbackup`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmbackup`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-vmbackup
|
||||||
|
```
|
||||||
|
@ -84,3 +84,10 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic
|
|||||||
Run `make package-vmrestore`. It builds `victoriametrics/vmrestore:<PKG_TAG>` docker image locally.
|
Run `make package-vmrestore`. It builds `victoriametrics/vmrestore:<PKG_TAG>` docker image locally.
|
||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmrestore`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmrestore`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-vmrestore
|
||||||
|
```
|
||||||
|
@ -1,16 +1,25 @@
|
|||||||
# All these commands must run from repository root.
|
# All these commands must run from repository root.
|
||||||
|
|
||||||
DOCKER_NAMESPACE := docker.io/victoriametrics
|
DOCKER_NAMESPACE := victoriametrics
|
||||||
BUILDER_IMAGE := local/builder:go1.14.2
|
|
||||||
BASE_IMAGE := local/base:1.1.0
|
ROOT_IMAGE ?= scratch
|
||||||
|
CERTS_IMAGE := alpine:3.11
|
||||||
|
GO_BUILDER_IMAGE := golang:1.14.2
|
||||||
|
BUILDER_IMAGE := local/builder:2.0.0-$(shell echo $(GO_BUILDER_IMAGE) | tr : _)
|
||||||
|
BASE_IMAGE := local/base:1.1.1-$(shell echo $(ROOT_IMAGE) | tr : _)-$(shell echo $(CERTS_IMAGE) | tr : _)
|
||||||
|
|
||||||
package-base:
|
package-base:
|
||||||
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(BASE_IMAGE)$$') \
|
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(BASE_IMAGE)$$') \
|
||||||
|| docker build -t $(BASE_IMAGE) deployment/docker/base
|
|| docker build -t $(BASE_IMAGE) \
|
||||||
|
--build-arg root_image=$(ROOT_IMAGE) \
|
||||||
|
--build-arg certs_image=$(CERTS_IMAGE) \
|
||||||
|
deployment/docker/base
|
||||||
|
|
||||||
package-builder:
|
package-builder:
|
||||||
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(BUILDER_IMAGE)$$') \
|
(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep -q '$(BUILDER_IMAGE)$$') \
|
||||||
|| docker build -t $(BUILDER_IMAGE) deployment/docker/builder
|
|| docker build -t $(BUILDER_IMAGE) \
|
||||||
|
--build-arg go_builder_image=$(GO_BUILDER_IMAGE) \
|
||||||
|
deployment/docker/builder
|
||||||
|
|
||||||
app-via-docker: package-base package-builder
|
app-via-docker: package-base package-builder
|
||||||
mkdir -p gocache-for-docker
|
mkdir -p gocache-for-docker
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# See https://medium.com/on-docker/use-multi-stage-builds-to-inject-ca-certs-ad1e8f01de1b
|
# See https://medium.com/on-docker/use-multi-stage-builds-to-inject-ca-certs-ad1e8f01de1b
|
||||||
FROM alpine:3.10 as base
|
ARG certs_image
|
||||||
|
ARG root_image
|
||||||
|
FROM $certs_image as certs
|
||||||
|
|
||||||
RUN apk --update --no-cache add ca-certificates
|
RUN apk --update --no-cache add ca-certificates
|
||||||
|
|
||||||
FROM scratch
|
FROM $root_image
|
||||||
|
|
||||||
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
FROM golang:1.14.2
|
ARG go_builder_image
|
||||||
|
FROM $go_builder_image
|
||||||
STOPSIGNAL SIGINT
|
STOPSIGNAL SIGINT
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
<img alt="Victoria Metrics" src="logo.png">
|
||||||
|
|
||||||
# Cluster version
|
# Cluster version
|
||||||
|
|
||||||
VictoriaMetrics is fast, cost-effective and scalable time series database. It can be used as a long-term remote storage for Prometheus.
|
VictoriaMetrics is fast, cost-effective and scalable time series database. It can be used as a long-term remote storage for Prometheus.
|
||||||
@ -89,7 +91,12 @@ Run `make package`. It will build the following docker images locally:
|
|||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package`.
|
||||||
|
|
||||||
|
By default images are built on top of `scratch` image. It is possible to build on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds images on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package
|
||||||
|
```
|
||||||
|
|
||||||
## Operation
|
## Operation
|
||||||
|
|
||||||
|
@ -559,6 +559,13 @@ Run `make package-victoria-metrics`. It builds `victoriametrics/victoria-metrics
|
|||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-victoria-metrics`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-victoria-metrics`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-victoria-metrics
|
||||||
|
```
|
||||||
|
|
||||||
### Start with docker-compose
|
### Start with docker-compose
|
||||||
|
|
||||||
[Docker-compose](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/docker-compose.yml)
|
[Docker-compose](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/docker-compose.yml)
|
||||||
|
@ -224,3 +224,10 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic
|
|||||||
Run `make package-vmagent`. It builds `victoriametrics/vmagent:<PKG_TAG>` docker image locally.
|
Run `make package-vmagent`. It builds `victoriametrics/vmagent:<PKG_TAG>` docker image locally.
|
||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmagent`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmagent`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-vmagent
|
||||||
|
```
|
||||||
|
@ -179,3 +179,10 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic
|
|||||||
Run `make package-vmbackup`. It builds `victoriametrics/vmbackup:<PKG_TAG>` docker image locally.
|
Run `make package-vmbackup`. It builds `victoriametrics/vmbackup:<PKG_TAG>` docker image locally.
|
||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmbackup`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmbackup`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-vmbackup
|
||||||
|
```
|
||||||
|
@ -84,3 +84,10 @@ It is recommended using [binary releases](https://github.com/VictoriaMetrics/Vic
|
|||||||
Run `make package-vmrestore`. It builds `victoriametrics/vmrestore:<PKG_TAG>` docker image locally.
|
Run `make package-vmrestore`. It builds `victoriametrics/vmrestore:<PKG_TAG>` docker image locally.
|
||||||
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
`<PKG_TAG>` is auto-generated image tag, which depends on source code in the repository.
|
||||||
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmrestore`.
|
The `<PKG_TAG>` may be manually set via `PKG_TAG=foobar make package-vmrestore`.
|
||||||
|
|
||||||
|
By default the image is built on top of `scratch` image. It is possible to build the package on top of any other base image
|
||||||
|
by setting it via `<ROOT_IMAGE>` environment variable. For example, the following command builds the image on top of `alpine:3.11` image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ROOT_IMAGE=alpine:3.11 make package-vmrestore
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user