{cmd/storagenode,Makefile}: add storagenode base image Dockerfile
Having the storagenode and storagenode-updater processes in one container requires a process manager to properly handle the individual processes. Using a process manager like supervisord requires that you package supervisord and it configuration in the image, along with the storagenode and storagenode-updater binaries. Installing supervisord requires that we run apk to install it and its dependencies at build time which makes it difficult to build multi-platoform images; executing apk forces a requirement of the build system to run foreign architechtures. This change adds a dockerfile which will be used to build the base image for the storagenode and has supervisord packaged. The base image will be built manually using docker buildx, with QEMU binfmt support. Updates https://github.com/storj/storj/issues/4489 Change-Id: I33f8f01398a7207bca08d8a4a43f4ed56b6a2473
This commit is contained in:
parent
53e851bfb2
commit
15a1428828
24
Makefile
24
Makefile
@ -5,12 +5,13 @@ GOPATH ?= $(shell go env GOPATH)
|
|||||||
NODE_VERSION ?= 16.11.1
|
NODE_VERSION ?= 16.11.1
|
||||||
COMPOSE_PROJECT_NAME := ${TAG}-$(shell git rev-parse --abbrev-ref HEAD)
|
COMPOSE_PROJECT_NAME := ${TAG}-$(shell git rev-parse --abbrev-ref HEAD)
|
||||||
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD | sed "s!/!-!g")
|
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD | sed "s!/!-!g")
|
||||||
|
GIT_TAG := $(shell git rev-parse --short HEAD)
|
||||||
ifeq (${BRANCH_NAME},main)
|
ifeq (${BRANCH_NAME},main)
|
||||||
TAG := $(shell git rev-parse --short HEAD)-go${GO_VERSION}
|
TAG := ${GIT_TAG}-go${GO_VERSION}
|
||||||
TRACKED_BRANCH := true
|
TRACKED_BRANCH := true
|
||||||
LATEST_TAG := latest
|
LATEST_TAG := latest
|
||||||
else
|
else
|
||||||
TAG := $(shell git rev-parse --short HEAD)-${BRANCH_NAME}-go${GO_VERSION}
|
TAG := ${GIT_TAG}-${BRANCH_NAME}-go${GO_VERSION}
|
||||||
ifneq (,$(findstring release-,$(BRANCH_NAME)))
|
ifneq (,$(findstring release-,$(BRANCH_NAME)))
|
||||||
TRACKED_BRANCH := true
|
TRACKED_BRANCH := true
|
||||||
LATEST_TAG := ${BRANCH_NAME}-latest
|
LATEST_TAG := ${BRANCH_NAME}-latest
|
||||||
@ -26,6 +27,8 @@ endif
|
|||||||
DOCKER_BUILD := docker build \
|
DOCKER_BUILD := docker build \
|
||||||
--build-arg TAG=${TAG}
|
--build-arg TAG=${TAG}
|
||||||
|
|
||||||
|
DOCKER_BUILDX := docker buildx build
|
||||||
|
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@ -234,6 +237,23 @@ storagenode-image: ## Build storagenode Docker image
|
|||||||
--build-arg=GOARCH=arm64 --build-arg=DOCKER_ARCH=arm64v8 --build-arg=APK_ARCH=aarch64 \
|
--build-arg=GOARCH=arm64 --build-arg=DOCKER_ARCH=arm64v8 --build-arg=APK_ARCH=aarch64 \
|
||||||
-f cmd/storagenode/Dockerfile .
|
-f cmd/storagenode/Dockerfile .
|
||||||
|
|
||||||
|
.PHONY: storagenode-base-image
|
||||||
|
storagenode-base-image: ## Build storagenode Docker base image. Requires buildx. This image is expected to be built manually using buildx and QEMU.
|
||||||
|
${DOCKER_BUILDX} --pull=true -t storjlabs/storagenode-base:${GIT_TAG}${CUSTOMTAG}-amd64 \
|
||||||
|
-f cmd/storagenode/Dockerfile.base .
|
||||||
|
${DOCKER_BUILDX} --pull=true -t storjlabs/storagenode-base:${GIT_TAG}${CUSTOMTAG}-arm32v6 \
|
||||||
|
--build-arg=GOARCH=arm --build-arg=DOCKER_ARCH=arm32v6 \
|
||||||
|
-f cmd/storagenode/Dockerfile.base .
|
||||||
|
${DOCKER_BUILDX} --pull=true -t storjlabs/storagenode-base:${GIT_TAG}${CUSTOMTAG}-arm64v8 \
|
||||||
|
--build-arg=GOARCH=arm64 --build-arg=DOCKER_ARCH=arm64v8 \
|
||||||
|
-f cmd/storagenode/Dockerfile.base .
|
||||||
|
|
||||||
|
.PHONY: push-storagenode-base-image
|
||||||
|
push-storagenode-base-image: ## Push the storagenode base image to dockerhub
|
||||||
|
docker push storjlabs/storagenode-base:${GIT_TAG}${CUSTOMTAG}-amd64
|
||||||
|
docker push storjlabs/storagenode-base:${GIT_TAG}${CUSTOMTAG}-arm32v6
|
||||||
|
docker push storjlabs/storagenode-base:${GIT_TAG}${CUSTOMTAG}-arm64v8
|
||||||
|
|
||||||
.PHONY: versioncontrol-image
|
.PHONY: versioncontrol-image
|
||||||
versioncontrol-image: versioncontrol_linux_arm versioncontrol_linux_arm64 versioncontrol_linux_amd64 ## Build versioncontrol Docker image
|
versioncontrol-image: versioncontrol_linux_arm versioncontrol_linux_arm64 versioncontrol_linux_amd64 ## Build versioncontrol Docker image
|
||||||
${DOCKER_BUILD} --pull=true -t storjlabs/versioncontrol:${TAG}${CUSTOMTAG}-amd64 \
|
${DOCKER_BUILD} --pull=true -t storjlabs/versioncontrol:${TAG}${CUSTOMTAG}-amd64 \
|
||||||
|
5
cmd/storagenode/Dockerfile.base
Normal file
5
cmd/storagenode/Dockerfile.base
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ARG DOCKER_ARCH
|
||||||
|
|
||||||
|
FROM ${DOCKER_ARCH:-amd64}/alpine:3.15
|
||||||
|
RUN apk --no-cache -U add ca-certificates supervisor
|
||||||
|
RUN mkdir -p /var/log/supervisor
|
Loading…
Reference in New Issue
Block a user