Add built-in cli to docker container (#114)

* add -faucet flag in scripts/build

* localhost guard on Faucet request

* add ark cli into docker image

* "BUILD_FLAG" => "BUILD_ARGS", "-faucet" => "with-faucet"

* [docker] use alpine:3.14 instead of debian

* Revert changes

* Expose docker volume for embedded wallet datadir

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
This commit is contained in:
Louis Singer
2024-02-20 17:28:08 +01:00
committed by GitHub
parent b8e0914ba9
commit ffcf08420f
4 changed files with 21 additions and 7 deletions

View File

@@ -12,9 +12,10 @@ WORKDIR /app
COPY . .
RUN cd server && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${COMMIT}' -X 'main.Commit=${COMMIT}' -X 'main.Date=${COMMIT}'" -o ../bin/arkd cmd/arkd/main.go
RUN cd client && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${COMMIT}' -X 'main.Commit=${COMMIT}' -X 'main.Date=${COMMIT}'" -o ../bin/ark .
# Second image, running the arkd executable
FROM debian:buster-slim
FROM alpine:3.12
WORKDIR /app
@@ -22,9 +23,11 @@ COPY --from=builder /app/bin/* /app
ENV PATH="/app:${PATH}"
ENV ARK_DATADIR=/app/data
ENV ARK_WALLET_DATADIR=/app/wallet-data
# Expose volume containing all 'arkd' data
VOLUME /app/data
VOLUME /app/wallet-data
ENTRYPOINT [ "arkd" ]

View File

@@ -7,10 +7,20 @@ PARENT_PATH=$(dirname $(
pwd -P
))
OS=$(eval "go env GOOS")
ARCH=$(eval "go env GOARCH")
if [[ -z $GOOS ]]; then
GOOS=$(eval "go env GOOS")
fi
if [[ -z $GOARCH ]]; then
GOARCH=$(eval "go env GOARCH")
fi
echo "Building for $GOOS $GOARCH"
pushd $PARENT_PATH
mkdir -p build
GO111MODULE=on go build -ldflags="-s -w" -o build/ark-cli-$OS-$ARCH .
GO111MODULE=on go build -ldflags="-s -w" -o build/ark-cli-$GOOS-$GOARCH .
popd

View File

@@ -11,12 +11,10 @@ declare -a OS=("darwin" "linux")
declare -a ARCH=("amd64" "arm64")
pushd $PARENT_PATH
mkdir -p build
for os in "${OS[@]}"; do
for arch in "${ARCH[@]}"; do
echo "Building for $os $arch"
GOOS=$os GOARCH=$arch go build -o build/ark-$os-$arch .
GOOS=$os GOARCH=$arch ./scripts/build
done
done

View File

@@ -33,6 +33,7 @@ services:
- "6000:6000"
volumes:
- arkd:/app/data
- ark:/app/wallet-data
volumes:
oceand:
@@ -41,6 +42,8 @@ volumes:
external: false
arkd:
external: false
ark:
external: false
networks:
default: