Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix docker build and publish stage #54

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ COPY . .
# SEA Builder
RUN npm run build:pkg && ./scripts/generate-sea.sh /bin/dclint

# Collect platform-specific dependencies
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN mkdir -p /dependencies/lib /dependencies/usr/lib && \
ldd /bin/dclint | awk '{print $3}' | grep -vE '^$' | while read -r lib; do \
if [ -f "$lib" ]; then \
if [ "${lib#/usr/lib/}" != "$lib" ]; then \
cp "$lib" /dependencies/usr/lib/; \
elif [ "${lib#/lib/}" != "$lib" ]; then \
cp "$lib" /dependencies/lib/; \
fi; \
fi; \
done

FROM alpine:3.19 AS alpine-version

ENV NODE_NO_WARNINGS=1
Expand Down Expand Up @@ -46,11 +59,11 @@ FROM scratch AS scratch-version

ENV NODE_NO_WARNINGS=1

COPY --from=builder "/usr/lib/libstdc++.so.6" "/usr/lib/libstdc++.so.6"
COPY --from=builder /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1
COPY --from=builder /lib/ld-musl-aarch64.so.1 /lib/ld-musl-aarch64.so.1
COPY --from=builder /lib/libc.musl-aarch64.so.1 /lib/libc.musl-aarch64.so.1
# Copy dependencies
COPY --from=builder /dependencies/lib /lib
COPY --from=builder /dependencies/usr/lib /usr/lib

# Copy dclint
COPY --from=builder /bin/dclint /bin/dclint

WORKDIR /app
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,19 @@ dev: docker ## Start development inside container. Note: node_modules, bin, pkg,
dev-sync: docker ## Start development inside container. Note: all files are synced.
docker run --rm -it -v ${PWD}:/app --entrypoint /bin/sh ${IMAGE_NAME}:${IMAGE_TAG}

######
# TEST SCRIPTS
######

docker-x: ## Build docker image with build-x.
docker buildx create --use
docker buildx build --file Dockerfile . --tag ${IMAGE_NAME}:${IMAGE_TAG} \
--platform linux/amd64,linux/arm64 \
--pull \
--build-arg BUILD_DATE=${BUILD_DATE} \
--build-arg BUILD_VERSION=${BUILD_VERSION} \
--build-arg BUILD_REVISION=${BUILD_REVISION} \
--progress plain

check-version: docker ## Check version in docker container. Note: all files are not synced.
docker run --rm -it ${IMAGE_NAME}:${IMAGE_TAG} -v