File tree Expand file tree Collapse file tree 4 files changed +24
-34
lines changed
Expand file tree Collapse file tree 4 files changed +24
-34
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ services:
33 lps :
44 build :
55 context : ../../
6- dockerfile : ${LPS_DOCKERFILE:- docker-compose/lps/Dockerfile}
6+ dockerfile : docker-compose/lps/Dockerfile
77 args :
88 UID : " ${LPS_UID}"
99 COMMIT_HASH : " ${COMMIT_HASH}"
1010 COMMIT_TAG : " ${COMMIT_TAG}"
1111 TARGETARCH : " ${LPS_DOCKER_ARCH}"
12+ USE_PREBUILT : " ${LPS_USE_PREBUILT:-source}"
1213 image : lps:latest
1314 container_name : lps01
1415 environment :
Original file line number Diff line number Diff line change @@ -24,19 +24,19 @@ if [[ "$OS_TYPE" == "Darwin" ]]; then
2424 # macOS
2525 echo " Running on macOS"
2626 SED_INPLACE=(" sed" " -i" " " )
27- LPS_DOCKERFILE_DEFAULT= " docker-compose/lps/Dockerfile. prebuilt"
27+ LPS_USE_PREBUILT_DEFAULT= " prebuilt"
2828elif [[ " $OS_TYPE " == " Linux" ]]; then
2929 # Assume Ubuntu or other Linux
3030 echo " Running on Linux"
3131 SED_INPLACE=(" sed" " -i" )
32- LPS_DOCKERFILE_DEFAULT= " docker-compose/lps/Dockerfile "
32+ LPS_USE_PREBUILT_DEFAULT= " source "
3333else
3434 echo " Unsupported OS: $OS_TYPE "
3535 exit 1
3636fi
3737
38- if [ -z " ${LPS_DOCKERFILE } " ]; then
39- export LPS_DOCKERFILE =" $LPS_DOCKERFILE_DEFAULT "
38+ if [ -z " ${LPS_USE_PREBUILT } " ]; then
39+ export LPS_USE_PREBUILT =" $LPS_USE_PREBUILT_DEFAULT "
4040fi
4141
4242if [ -z " ${LPS_DOCKER_ARCH} " ]; then
@@ -339,7 +339,7 @@ echo " DISCOVERY_ADDRESS: $DISCOVERY_ADDRESS"
339339
340340docker compose --env-file " $ENV_FILE " up -d powpeg-pegin powpeg-pegout
341341
342- if [ " $LPS_DOCKERFILE " = " docker-compose/lps/Dockerfile. prebuilt" ]; then
342+ if [ " $LPS_USE_PREBUILT " = " prebuilt" ]; then
343343 # Build LPS binary locally (cross-compile) to avoid Go segfault in Docker on Mac
344344 echo " Building LPS binary locally (cross-compile for linux/${LPS_DOCKER_ARCH} )..."
345345 pushd ../../ > /dev/null
Original file line number Diff line number Diff line change 1- FROM --platform=linux/amd64 golang:1.23.8@sha256:e54daaadd35ebb90fc1404ecdc6eb7338ae13555f71a71856ad96976ae084e44 AS builder
1+ ARG USE_PREBUILT=source
2+ ARG TARGETARCH=amd64
3+
4+ # Builder stage for compiling from source
5+ FROM --platform=linux/${TARGETARCH} golang:1.23.8@sha256:e54daaadd35ebb90fc1404ecdc6eb7338ae13555f71a71856ad96976ae084e44 AS builder-source
26
37ARG COMMIT_HASH
48ARG COMMIT_TAG
@@ -19,9 +23,19 @@ RUN if [[ "$LPS_STAGE" != "regtest" ]]; \
1923 else make build; \
2024 fi
2125
22- FROM --platform=linux/amd64 alpine:3.19.1@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b
26+ # Builder stage for pre-built binary
27+ FROM --platform=linux/${TARGETARCH} alpine:3.19.1@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b AS builder-prebuilt
28+
29+ WORKDIR /code
30+ COPY build/liquidity-provider-server /code/build/liquidity-provider-server
31+
32+ # Select the appropriate builder based on USE_PREBUILT arg
33+ FROM builder-${USE_PREBUILT} AS selected-builder
34+
35+ # Final stage
36+ FROM --platform=linux/${TARGETARCH} alpine:3.19.1@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b
2337
24- COPY --from=builder /code/build/liquidity-provider-server /usr/local/bin/liquidity-provider-server
38+ COPY --from=selected- builder /code/build/liquidity-provider-server /usr/local/bin/liquidity-provider-server
2539
2640ARG HOME="/home/lps"
2741RUN adduser -u 1000 --home="$HOME" lps -D lps
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments