Docker: allow setting BUILD_VERSION as a build argument (#2736)
* Docker: allow setting BUILD_VERSION as a build argument * CI: don't attempt to publish docker images outside of crowdecurity org * use go 1.21.6 for docker and windows too
This commit is contained in:
parent
6ca053ca67
commit
03bb194d2c
6 changed files with 15 additions and 5 deletions
|
@ -19,6 +19,7 @@ jobs:
|
||||||
push_to_registry:
|
push_to_registry:
|
||||||
name: Push Debian Docker image to Docker Hub
|
name: Push Debian Docker image to Docker Hub
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.repository_owner == 'crowdsecurity' }}
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
|
|
|
@ -19,6 +19,7 @@ jobs:
|
||||||
push_to_registry:
|
push_to_registry:
|
||||||
name: Push Docker image to Docker Hub
|
name: Push Docker image to Docker Hub
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.repository_owner == 'crowdsecurity' }}
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# vim: set ft=dockerfile:
|
# vim: set ft=dockerfile:
|
||||||
ARG GOVERSION=1.21.5
|
ARG GOVERSION=1.21.6
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
|
||||||
FROM golang:${GOVERSION}-alpine3.18 AS build
|
FROM golang:${GOVERSION}-alpine3.18 AS build
|
||||||
|
|
||||||
|
@ -7,6 +8,7 @@ WORKDIR /go/src/crowdsec
|
||||||
|
|
||||||
# We like to choose the release of re2 to use, and Alpine does not ship a static version anyway.
|
# We like to choose the release of re2 to use, and Alpine does not ship a static version anyway.
|
||||||
ENV RE2_VERSION=2023-03-01
|
ENV RE2_VERSION=2023-03-01
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
|
||||||
# wizard.sh requires GNU coreutils
|
# wizard.sh requires GNU coreutils
|
||||||
RUN apk add --no-cache git g++ gcc libc-dev make bash gettext binutils-gold coreutils pkgconfig && \
|
RUN apk add --no-cache git g++ gcc libc-dev make bash gettext binutils-gold coreutils pkgconfig && \
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# vim: set ft=dockerfile:
|
# vim: set ft=dockerfile:
|
||||||
ARG GOVERSION=1.21.5
|
ARG GOVERSION=1.21.6
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
|
||||||
FROM golang:${GOVERSION}-bookworm AS build
|
FROM golang:${GOVERSION}-bookworm AS build
|
||||||
|
|
||||||
|
@ -10,6 +11,7 @@ ENV DEBCONF_NOWARNINGS="yes"
|
||||||
|
|
||||||
# We like to choose the release of re2 to use, the debian version is usually older.
|
# We like to choose the release of re2 to use, the debian version is usually older.
|
||||||
ENV RE2_VERSION=2023-03-01
|
ENV RE2_VERSION=2023-03-01
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
|
||||||
# wizard.sh requires GNU coreutils
|
# wizard.sh requires GNU coreutils
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|
|
@ -25,9 +25,9 @@ stages:
|
||||||
custom: 'tool'
|
custom: 'tool'
|
||||||
arguments: 'install --global SignClient --version 1.3.155'
|
arguments: 'install --global SignClient --version 1.3.155'
|
||||||
- task: GoTool@0
|
- task: GoTool@0
|
||||||
displayName: "Install Go 1.20"
|
displayName: "Install Go"
|
||||||
inputs:
|
inputs:
|
||||||
version: '1.21.5'
|
version: '1.21.6'
|
||||||
|
|
||||||
- pwsh: |
|
- pwsh: |
|
||||||
choco install -y make
|
choco install -y make
|
||||||
|
|
|
@ -8,7 +8,11 @@ MKDIR=mkdir -p
|
||||||
GOOS ?= $(shell go env GOOS)
|
GOOS ?= $(shell go env GOOS)
|
||||||
|
|
||||||
# Current versioning information from env
|
# Current versioning information from env
|
||||||
BUILD_VERSION?=$(shell git describe --tags)
|
# The $(or) is used to ignore an empty BUILD_VERSION when it's an envvar,
|
||||||
|
# like inside a docker build: docker build --build-arg BUILD_VERSION=1.2.3
|
||||||
|
# as opposed to a make parameter: make BUILD_VERSION=1.2.3
|
||||||
|
BUILD_VERSION:=$(or $(BUILD_VERSION),$(shell git describe --tags --dirty))
|
||||||
|
|
||||||
BUILD_TIMESTAMP=$(shell date +%F"_"%T)
|
BUILD_TIMESTAMP=$(shell date +%F"_"%T)
|
||||||
DEFAULT_CONFIGDIR?=/etc/crowdsec
|
DEFAULT_CONFIGDIR?=/etc/crowdsec
|
||||||
DEFAULT_DATADIR?=/var/lib/crowdsec/data
|
DEFAULT_DATADIR?=/var/lib/crowdsec/data
|
||||||
|
|
Loading…
Reference in a new issue