blob: ee306dd7e7acde5036cc00c1ccce1860f25e9992 [file]
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#Apache DevLake is an effort undergoing incubation at The Apache Software
#Foundation (ASF), sponsored by the Apache Incubator PMC.
#
#Incubation is required of all newly accepted projects until a further review
#indicates that the infrastructure, communications, and decision making process
#have stabilized in a manner consistent with other successful ASF projects.
#
#While incubation status is not necessarily a reflection of the completeness or stability of the code,
#it does indicate that the project has yet to be fully endorsed by the ASF.
FROM golang:1.26-bookworm as builder
ARG GOPROXY=
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
RUN apt-get update && apt-get install -y \
gcc \
binutils \
libfindbin-libs-perl \
cmake \
libssh2-1-dev \
libssl-dev \
zlib1g-dev
# Install libgit2 for native platform only
RUN mkdir -p /tmp/build && cd /tmp/build && \
wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.3.0.tar.gz -O - | tar -xz && \
cd libgit2-1.3.0 && \
mkdir build && cd build && \
cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local && \
make -j$(nproc) install && \
ldconfig
RUN go install github.com/vektra/mockery/v2@v2.53.6
RUN go install github.com/swaggo/swag/cmd/swag@v1.16.1
WORKDIR /app
COPY . /app
ENV GOBIN=/app/bin
ARG TAG=
ARG SHA=
# Generate mocks and swagger
RUN make mock
RUN make swag
# Build plugins
RUN make build-plugin
# Build server
RUN VERSION=${TAG}@${SHA} make build-server
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
libssh2-1 \
libssl3 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy libgit2
COPY --from=builder /usr/local/lib/libgit2.so* /usr/local/lib/
RUN ldconfig
WORKDIR /app
COPY --from=builder /app/bin ./bin
# Create empty python plugins dir to avoid startup error
RUN mkdir -p python/plugins
ENV PORT=8080
EXPOSE 8080
CMD ["./bin/lake"]