From 29f4edc059bd654f666b56710aba95f2672389d3 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Tue, 14 Nov 2023 15:34:07 +0100 Subject: [PATCH] chore(lander): fix Docker build --- .dockerignore | 19 +++++++++++++++---- Dockerfile | 13 +++++++------ Makefile | 12 +++++------- config.mk | 4 ++-- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/.dockerignore b/.dockerignore index 4570fd8..9bda86a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,15 @@ -data/ -build/ -trie/build/ -.git/ +* + +!src/ +!include/ + +!lsm/src/ +!lsm/include/ +!lsm/Makefile +!lsm/config.mk + +!thirdparty/include +!thirdparty/src + +!Makefile +!config.mk diff --git a/Dockerfile b/Dockerfile index 2b7b000..dd4eb42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,12 @@ -FROM alpine:3.18.0 AS builder +FROM ubuntu:23.10 AS builder ARG DI_VER=1.2.5 -RUN apk add --update --no-cache \ - build-base \ - make \ - curl +RUN apt update && \ + apt install -y --no-install-recommends \ + curl ca-certificates \ + build-essential \ + musl musl-dev musl-tools WORKDIR /app @@ -18,7 +19,7 @@ RUN curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.t COPY . ./ -RUN make CFLAGS='-O3' LDFLAGS='-static -flto' && \ +RUN make CFLAGS='-O3' LDFLAGS='-flto -static' && \ strip build/lander && \ readelf -d build/lander && \ [ "$(readelf -d build/lander | grep NEEDED | wc -l)" = 0 ] diff --git a/Makefile b/Makefile index c40c27a..63c35f2 100644 --- a/Makefile +++ b/Makefile @@ -35,15 +35,11 @@ all: $(BIN) .PHONY: objs objs: $(OBJS) -.PHONY: libtrie -libtrie: - $(MAKE) -C trie - .PHONY: liblsm liblsm: $(MAKE) -C lsm -$(BIN): libtrie liblsm $(OBJS) +$(BIN): liblsm $(OBJS) $(CC) -o $@ $(OBJS) $(_LDFLAGS) $(BUILD_DIR)/$(SRC_DIR)/%.c.o: $(SRC_DIR)/%.c @@ -126,12 +122,14 @@ check: --enable=warning,style \ -ithirdparty/* \ -itrie/* \ - --quiet + --inline-suppr \ + --check-level=exhaustive \ + --quiet \ + -j$(shell nproc) .PHONY: clean clean: rm -rf $(BUILD_DIR) - $(MAKE) -C trie clean $(MAKE) -C lsm clean diff --git a/config.mk b/config.mk index 8336cd1..9b22a21 100644 --- a/config.mk +++ b/config.mk @@ -8,8 +8,8 @@ TEST_DIR = test THIRDPARTY_DIR = thirdparty INC_DIRS = include $(THIRDPARTY_DIR)/include trie/include lsm/include -LIBS = trie m lsm -LIB_DIRS = ./trie/build ./lsm/build +LIBS = m lsm +LIB_DIRS = ./lsm/build # -MMD: generate a .d file for every source file. This file can be imported by # make and makes make aware that a header file has been changed, ensuring an