Skip to content

Commit

Permalink
Merge pull request #87 from geniusyield/multi-stage-docker-build
Browse files Browse the repository at this point in the history
Setup multi-stage build
  • Loading branch information
sourabhxyz authored Nov 4, 2024
2 parents a5b04da + 4888ea5 commit 1cf3008
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
29 changes: 27 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bullseye-slim
FROM debian:bullseye-slim as build

ENV LANG C.UTF-8

Expand Down Expand Up @@ -50,7 +50,7 @@ RUN git clone https://github.com/bitcoin-core/secp256k1 && \
cd secp256k1 && \
git checkout ac83be33d0956faf6b7f61a60ab524ef7d6a473a && \
./autogen.sh && \
./configure --prefix=/usr --enable-module-schnorrsig --enable-experimental && \
./configure --prefix=/usr/local --enable-module-schnorrsig --enable-experimental && \
make && \
make install

Expand Down Expand Up @@ -101,8 +101,33 @@ RUN git init && \
git commit -m "Dummy commit"
RUN cabal update
RUN cabal build all --enable-tests --enable-benchmarks
RUN cp $(cabal list-bin geniusyield-server) /DEX/geniusyield-server

# =============================[ SERVER ]================================
FROM debian:bullseye-slim

ENV LANG C.UTF-8

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgmp10 \
libpq5 \
libssl1.1 \
libsystemd0 \
libtinfo6 \
procps && \
rm -rf /var/lib/apt/lists/*

COPY --from=build /usr/local/lib /usr/local/lib
COPY --from=build /usr/local/bin/yq /usr/local/bin/yq
COPY --from=build /DEX/start.sh /DEX/start.sh
COPY --from=build /DEX/geniusyield-server /usr/local/bin/geniusyield-server
COPY --from=build /DEX/web /DEX/web

ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"

WORKDIR /DEX

LABEL org.opencontainers.image.source="https://github.com/geniusyield/dex-contracts-api"

ENTRYPOINT ["/bin/bash", "./start.sh"]
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ fi
echo "===================================="
echo "Starting geniusyield-server..."
set -x
cabal run geniusyield-server -- serve
geniusyield-server serve

0 comments on commit 1cf3008

Please sign in to comment.