adding local and indra.Dockerfile
This commit is contained in:
committed by
David Vennik
parent
e7075e1e39
commit
1912ac0373
@@ -1,63 +0,0 @@
|
||||
|
||||
FROM golang:1.19.4 AS builder
|
||||
|
||||
# User/Group definition
|
||||
ENV USER=indra GROUP=indra UID=8337 GID=8337
|
||||
|
||||
# Create a user/group for indra, to be migrated to the target container
|
||||
RUN addgroup ${GROUP} --gid ${GID} \
|
||||
&& adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/var/indra" \
|
||||
--shell "/sbin/nologin" \
|
||||
#--no-create-home \
|
||||
--uid "${UID}" \
|
||||
--gid "${GID}" \
|
||||
"${USER}" \
|
||||
&& mkdir -pv /var/indra/.indra && chown -R indra:indra /var/indra
|
||||
|
||||
# Source/Target release defaults
|
||||
ARG ARCH=amd64
|
||||
ARG GOARCH=amd64
|
||||
|
||||
ENV GO111MODULE=on GOOS=linux
|
||||
|
||||
WORKDIR $GOPATH/src/github.com/indra-labs/indra
|
||||
ADD . .
|
||||
|
||||
RUN set -ex \
|
||||
# && if [ "${ARCH}" = "amd64" ]; then export GOARCH=amd64; fi \
|
||||
# && if [ "${ARCH}" = "arm32v7" ]; then export GOARCH=arm; fi \
|
||||
# && if [ "${ARCH}" = "arm64v8" ]; then export GOARCH=arm64; fi \
|
||||
&& go install -v ./cmd/indra/. \
|
||||
&& CGO_ENABLED=0 go build --ldflags '-w -s' -o /bin/indra ./cmd/indra/.
|
||||
|
||||
# ---
|
||||
# Configure and Build the target container
|
||||
# ---
|
||||
|
||||
FROM scratch
|
||||
|
||||
# Migrate User/Group to target
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
COPY --from=builder /etc/group /etc/group
|
||||
|
||||
# Migrate the binaries and storage folder
|
||||
COPY --from=builder --chown=indra:indra /bin /bin
|
||||
COPY --from=builder --chown=indra:indra /var/indra /var/indra
|
||||
|
||||
# Enable the indra user
|
||||
USER indra:indra
|
||||
|
||||
# ENV defaults
|
||||
# ENV IND_LOGFILEPATH=""
|
||||
|
||||
# Set the data volume
|
||||
#VOLUME ["/var/indra"]
|
||||
|
||||
# :8337 indra peer-to-peer port
|
||||
# :8338 indra RPC port
|
||||
EXPOSE 8337 8338
|
||||
|
||||
ENTRYPOINT ["/bin/indra"]
|
||||
38
docker/indra/indra.Dockerfile
Normal file
38
docker/indra/indra.Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
# ---
|
||||
# Build Process
|
||||
# ---
|
||||
|
||||
ARG source_version="v0.1.7"
|
||||
ARG scratch_version="latest"
|
||||
|
||||
FROM indralabs/indra-source-local:${source_version} as source
|
||||
|
||||
ARG target_os="linux"
|
||||
ARG target_arch="amd64"
|
||||
ARG target_arm_version=""
|
||||
|
||||
RUN set -ex echo "building binaries for ${target_os}/${target_arch}" \
|
||||
&& CGO_ENABLED=0 GOOS=${target_os} GOARCH=${target_arch} GOARM=${target_arm_version} go build --ldflags '-w -s' -o /tmp/bin/indra ./cmd/indra/.
|
||||
|
||||
# ---
|
||||
# Target Configuration
|
||||
# ---
|
||||
|
||||
FROM indralabs/scratch:${scratch_version}
|
||||
|
||||
## Migrate the binaries and storage folder
|
||||
COPY --from=source /tmp/bin/indra /bin
|
||||
|
||||
# Enable the btcd user
|
||||
USER indra:indra
|
||||
|
||||
# Set the data volumes
|
||||
#VOLUME ["/etc/indra"]
|
||||
#VOLUME ["/var/indra"]
|
||||
|
||||
# :8333 indra peer-to-peer port
|
||||
# :8334 indra RPC port
|
||||
EXPOSE 8337 8338
|
||||
|
||||
ENTRYPOINT ["/bin/indra", "--conffile=/etc/indra/indra.conf"]
|
||||
17
docker/indra/source/local.Dockerfile
Normal file
17
docker/indra/source/local.Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
# ---
|
||||
# Build Process
|
||||
# ---
|
||||
|
||||
ARG sourcing_image="golang"
|
||||
|
||||
FROM indralabs/scratch:latest as scratch
|
||||
|
||||
FROM ${sourcing_image}
|
||||
|
||||
ADD . /tmp/indra-source
|
||||
|
||||
WORKDIR /tmp/indra-source
|
||||
|
||||
RUN set -ex echo "downloading modules" \
|
||||
&& go mod vendor
|
||||
Reference in New Issue
Block a user