|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | +# |
| 19 | + |
| 20 | +ARG ALPINE_VERSION=3.20 |
| 21 | + |
| 22 | +# Builds an Alpine image with kinesis_producer compiled for Alpine Linux / musl |
| 23 | + |
| 24 | +# Build stage |
| 25 | +FROM alpine:$ALPINE_VERSION AS kinesis-producer-build |
| 26 | +ENV KINESIS_PRODUCER_LIB_VERSION=0.15.12 |
| 27 | + |
| 28 | +# Install build dependencies |
| 29 | +RUN apk update && apk add --no-cache \ |
| 30 | + git \ |
| 31 | + binutils \ |
| 32 | + coreutils \ |
| 33 | + alpine-sdk \ |
| 34 | + util-linux \ |
| 35 | + cmake \ |
| 36 | + autoconf \ |
| 37 | + automake \ |
| 38 | + libtool \ |
| 39 | + curl \ |
| 40 | + bash \ |
| 41 | + tar \ |
| 42 | + libuuid \ |
| 43 | + linux-headers \ |
| 44 | + zlib \ |
| 45 | + zlib-dev \ |
| 46 | + perl \ |
| 47 | + wget \ |
| 48 | + boost-dev \ |
| 49 | + openssl-dev \ |
| 50 | + curl-dev \ |
| 51 | + build-base \ |
| 52 | + util-linux-dev \ |
| 53 | + g++ \ |
| 54 | + make \ |
| 55 | + upx |
| 56 | + |
| 57 | +ENV LANG=C.UTF-8 |
| 58 | + |
| 59 | +RUN mkdir /build |
| 60 | +COPY kinesis_producer_alpine.patch /build/ |
| 61 | + |
| 62 | +# Clone KPL and copy build script |
| 63 | +RUN cd /build && \ |
| 64 | + git clone --depth 1 --single-branch --branch v${KINESIS_PRODUCER_LIB_VERSION} https://github.com/awslabs/amazon-kinesis-producer && \ |
| 65 | + cd amazon-kinesis-producer && \ |
| 66 | + git apply ../kinesis_producer_alpine.patch |
| 67 | + |
| 68 | +# Copy and execute build script |
| 69 | +COPY build-alpine.sh /build/ |
| 70 | +RUN chmod +x /build/build-alpine.sh |
| 71 | +RUN /build/build-alpine.sh |
| 72 | + |
| 73 | +# Final stage |
| 74 | +FROM alpine:$ALPINE_VERSION |
| 75 | +COPY --from=kinesis-producer-build /opt/amazon-kinesis-producer /opt/amazon-kinesis-producer |
| 76 | +RUN apk update && apk add --no-cache \ |
| 77 | + brotli-libs \ |
| 78 | + c-ares \ |
| 79 | + libcrypto3 \ |
| 80 | + libcurl \ |
| 81 | + libgcc \ |
| 82 | + libidn2 \ |
| 83 | + libpsl \ |
| 84 | + libssl3 \ |
| 85 | + libunistring \ |
| 86 | + nghttp2-libs \ |
| 87 | + zlib \ |
| 88 | + zstd-libs \ |
| 89 | + libuuid |
| 90 | +WORKDIR /opt/amazon-kinesis-producer/bin |
0 commit comments