Skip to content

Commit

Permalink
libs should be copied after build is complete (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin committed Jun 19, 2023
1 parent 9764703 commit 4bd8a17
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions dockerfile/cosmos/local.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_VERSION
FROM golang:${BASE_VERSION} AS build-env
FROM golang:${BASE_VERSION} AS init-env

RUN apk add --update --no-cache curl make git libc-dev bash gcc linux-headers eudev-dev ncurses-dev

Expand All @@ -21,12 +21,6 @@ RUN set -eux; \
fi; \
go mod download;

RUN mkdir -p /root/lib
ARG LIBRARIES
ENV LIBRARIES_ENV ${LIBRARIES}
RUN bash -c 'set -eux;\
LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do cp $LIBRARY /root/lib/; done'

# Use minimal busybox from infra-toolkit image for final scratch image
FROM ghcr.io/strangelove-ventures/infra-toolkit:v0.0.7 AS infra-toolkit
RUN addgroup --gid 1025 -S heighliner && adduser --uid 1025 -S heighliner -G heighliner
Expand All @@ -41,9 +35,6 @@ LABEL org.opencontainers.image.source="https://github.com/strangelove-ventures/h

WORKDIR /bin

# Install libraries
COPY --from=build-env /root/lib /lib

# Install ln (for making hard links) and rm (for cleanup) from full busybox image (will be deleted, only needed for image assembly)
COPY --from=busybox-full /bin/ln /bin/rm ./

Expand Down Expand Up @@ -93,7 +84,7 @@ COPY --from=infra-toolkit --chown=1025:1025 /home/heighliner /home/heighliner


# Install chain binary
FROM build-env AS build-env2
FROM init-env AS build-env

ARG BUILD_TARGET
ARG BUILD_ENV
Expand Down Expand Up @@ -149,12 +140,21 @@ RUN bash -c 'set -eux;\
fi;\
done'

RUN mkdir -p /root/lib
ARG LIBRARIES
ENV LIBRARIES_ENV ${LIBRARIES}
RUN bash -c 'set -eux;\
LIBRARIES_ARR=($LIBRARIES_ENV); for LIBRARY in "${LIBRARIES_ARR[@]}"; do cp $LIBRARY /root/lib/; done'

# Move final binary to the final image
FROM final-part1 as final
WORKDIR /bin

# Install chain binaries
COPY --from=build-env2 /root/bin /bin
COPY --from=build-env /root/bin /bin

# Install libraries
COPY --from=build-env /root/lib /lib

WORKDIR /home/heighliner
USER heighliner

0 comments on commit 4bd8a17

Please sign in to comment.