From 86ab703fb278bc50a9f5b9330285b69e8764e8f3 Mon Sep 17 00:00:00 2001 From: Kinshuk Bairagi Date: Tue, 6 Sep 2022 15:47:22 +0530 Subject: [PATCH] merge conflicts --- .github/workflows/docker.yaml | 3 +-- .github/workflows/main.yml | 1 - Dockerfile | 39 +++++++++++++---------------------- Makefile | 2 +- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4bc50a26..5e83c2ee 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -62,7 +62,7 @@ jobs: - name: Build Docker Image uses: docker/build-push-action@v3 with: - push: ${{ github.event_name != 'pull_request' }} + push: true # ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} # platforms: linux/amd64,linux/arm64 @@ -71,7 +71,6 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max build-args: | - BASE=ubuntu:20.04 GIT_SHA=${{ steps.sha_extract.outputs.sha }} - name: Move cache run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5ca9e74..d26c96d9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,7 +50,6 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max build-args: | - BASE=ubuntu:20.04 CI=true - name: Run tests run: | diff --git a/Dockerfile b/Dockerfile index aeacd027..e0388935 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,31 @@ -ARG BASE=ubuntu:20.04 -FROM $BASE +FROM golang:1.18-alpine LABEL maintainer="DKV Developers (dkv-dev@googlegroups.com)" -RUN apt-get update && \ - # Install basic utilities - apt-get install --yes --allow-unauthenticated adduser vim sudo git curl unzip build-essential \ - # Install Compression libs - zlib1g-dev libbz2-dev libsnappy-dev liblz4-dev && \ - # Cleanup - apt-get clean && rm -rf /var/lib/apt/lists/* +RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >>/etc/apk/repositories -# Install ZStandard lib -RUN curl -fsSL https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-1.4.4.tar.gz | tar xz \ - && cd zstd-1.4.4 && make install +# Build tools +RUN apk add --update --no-cache linux-headers git make cmake gcc g++ musl musl-dev binutils autoconf automake libtool pkgconfig check-dev file patch bash curl dpkg nano -# Install RocksDB v6.5.3 -RUN curl -fsSL https://github.com/facebook/rocksdb/archive/v6.22.1.tar.gz | tar xz \ - && cd rocksdb-6.22.1 && make install +# Dependencies +RUN apk add --update --no-cache zlib zlib-dev zlib-static bzip2 bzip2-dev bzip2-static snappy snappy-dev snappy-static lz4 lz4-dev lz4-static gflags-dev zstd zstd-dev zstd-static -# Install GoLang -RUN curl -fsSL https://dl.google.com/go/go1.18.1.linux-$(dpkg --print-architecture).tar.gz | tar xz \ - && chown -R root:root ./go && mv ./go /usr/local -ENV PATH="/usr/local/go/bin:${PATH}" +# Install RocksDB +RUN git clone --branch v6.22.1 --depth 1 https://github.com/facebook/rocksdb.git && \ + cd rocksdb && \ + # Fix 'install -c' flag + sed -i 's/install -C/install -c/g' Makefile && \ + make -j4 static_lib && make install-static -# Install Protobuf -#RUN curl -fsSL -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip \ -# && unzip protoc.zip -d protoc && chown -R root:root ./protoc && mv ./protoc /usr/local && rm protoc.zip -#ENV PATH="/usr/local/protoc/bin:${PATH}" +ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" # Install DKV (Skipped for CI Pipelines) ARG CI ARG GIT_SHA=master RUN if [ -z "$CI" ] ; then git clone https://github.com/flipkart-incubator/dkv.git \ - && cd dkv && git checkout $GIT_SHA && GOOS=linux GOARCH=$(dpkg --print-architecture) make build \ + && cd dkv && git checkout $GIT_SHA && GOOS=linux GOARCH=$(dpkg --print-architecture | awk -F'-' '{print $NF}') make build \ && mv ./bin /usr/local/dkv && chown -R root:root /usr/local/dkv; fi ENV PATH="/usr/local/dkv:${PATH}" -ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" CMD ["dkvsrv"] diff --git a/Makefile b/Makefile index 0a94bac4..9df1c39b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ ifeq ($(VERSION),) endif BUILD_TAGS = 'osusergo netgo static_build' -ALDFLAGS = -ldflags '-linkmode external -extldflags "-static" -X "github.com/flipkart-incubator/dkv/version.Version=$(VERSION)"' +ALDFLAGS = -ldflags '-linkmode external -extldflags -static -X "github.com/flipkart-incubator/dkv/version.Version=$(VERSION)"' ifeq ($(GOOS),darwin) ALDFLAGS = -ldflags '-X "github.com/flipkart-incubator/dkv/version.Version=$(VERSION)"'