Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# .dockerignore

*
!fencing/
!package.sh
!nfpm.yaml
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG GOLANG_IMAGE_NAME="golang"
ARG GOLANG_IMAGE_VERSION="latest"

FROM ${GOLANG_IMAGE_NAME}:${GOLANG_IMAGE_VERSION}

# Set build arguments with default values
ARG VERSION="none"
ARG BUILD="none"
ARG TIME="none"
ARG GOPROXY=http://yum-repo.vpn.versity.com:4000

# Set environment variables
ENV VERSION=${VERSION}
ENV BUILD=${BUILD}
ENV TIME=${TIME}
ENV GOPROXY=${GOPROXY}

ENV CGO_ENABLED=0
RUN go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest

COPY fencing/fence-remote-host /scoutfs-fencing/
COPY fencing/README.md /scoutfs-fencing/

COPY package.sh /
COPY nfpm.yaml /scoutfs-fencing/

ENTRYPOINT [ "/package.sh" ]
16 changes: 16 additions & 0 deletions build_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -ex

PULL="${PULL:-true}"
GOLANG_IMAGE_NAME="${GOLANG_IMAGE_NAME:-golang}"
GOLANG_IMAGE_VERSION="${GOLANG_IMAGE_VERSION:-latest}"

export VERSION
VERSION="$(git describe --tags)"

docker build --pull="${PULL}" \
--build-arg "GOLANG_IMAGE_NAME=${GOLANG_IMAGE_NAME}" \
--build-arg "GOLANG_IMAGE_VERSION=${GOLANG_IMAGE_VERSION}" \
-t "versity-scripts:${VERSION}" .

docker run --rm -e "HOST_UID=${UID}" -e "VERSION=${VERSION}" -v "${PWD}/package:/package" "versity-scripts:${VERSION}"
Empty file modified fencing/fence-remote-host
100644 → 100755
Empty file.
23 changes: 23 additions & 0 deletions nfpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "scoutfs-scripts"
arch: "amd64"
platform: "linux"
version: "${VERSION}"
section: "default"
priority: "extra"
provides:
- scoutfs-scripts
maintainer: "Versity <support@versity.com>"
description: |
This includes various support scripts and extra documentation for advanced ScoutFS usage.
vendor: "Versity, Inc."
homepage: "http://versity.com"
license: ""
umask: 0o002
#changelog: "changelog.yaml"
contents:
- src: /scoutfs-fencing/fence-remote-host
dst: /usr/libexec/scoutfs-fenced/run/fence-remote-host
- src: /scoutfs-fencing/ipmi-remote-host
dst: /usr/libexec/scoutfs-fenced/run/ipmi-remote-host
- src: /scoutfs-fencing/README.md
dst: /usr/libexec/scoutfs-fenced/run/README.md
7 changes: 7 additions & 0 deletions package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

export PATH="/go/bin:${PATH}"
HOST_UID="${HOST_UID:-$UID}"

nfpm pkg --packager rpm --config /scoutfs-fencing/nfpm.yaml --target /package
chown -R "${HOST_UID}" /package
Empty file added package/.keep
Empty file.