Skip to content

Commit

Permalink
Added legacy build Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmit799 committed Aug 22, 2023
1 parent 54c97a8 commit f01d7f0
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 8 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- dockerfile: ./Dockerfile
image: ${{ env.REGISTRY }}/ksmit799/ardos
- dockerfile: ./Dockerfile-legacy
image: ${{ env.REGISTRY }}/ksmit799/ardos-legacy

permissions:
contents: read
packages: write
Expand All @@ -31,14 +38,15 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ matrix.image }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ RUN set -ex; \
apt-get update; \
apt-get install -y cmake g++ gcc curl libssl-dev;

# Setup directories.
WORKDIR /app
RUN mkdir build
RUN mkdir repos

# Install/build MongoDB C driver.
WORKDIR /app/repos
RUN curl -OL https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz
Expand Down
49 changes: 49 additions & 0 deletions Dockerfile-legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:23.10 as build

# Install dependencies.
RUN set -ex; \
apt-get update; \
apt-get install -y cmake g++ gcc curl libssl-dev;

# Install/build MongoDB C driver.
WORKDIR /app/repos
RUN curl -OL https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz
RUN tar -xzf mongo-c-driver-1.24.3.tar.gz
WORKDIR /app/repos/mongo-c-driver-1.24.3/cmake-build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_TESTS=OFF
RUN cmake --build . --target install

# Install/build MongoDB CXX driver.
WORKDIR /app/repos
RUN curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.8.0/mongo-cxx-driver-r3.8.0.tar.gz
RUN tar -xzf mongo-cxx-driver-r3.8.0.tar.gz
WORKDIR /app/repos/mongo-cxx-driver-r3.8.0/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=20 -DENABLE_TESTS=OFF
RUN cmake --build . --target install

# Install/build Prometheus metrics.
WORKDIR /app/repos
RUN curl -OL https://github.com/jupp0r/prometheus-cpp/releases/download/v1.1.0/prometheus-cpp-with-submodules.tar.gz
RUN tar -xzf prometheus-cpp-with-submodules.tar.gz
WORKDIR /app/repos/prometheus-cpp-with-submodules/_build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=20 -DBUILD_SHARED_LIBS=ON -DENABLE_PUSH=OFF -DENABLE_COMPRESSION=OFF
RUN cmake --build . --target install

# Copy source files.
COPY . /app

# Build.
WORKDIR /app/build
RUN cmake .. -DCMAKE_BUILD_TYPE=Release -DARDOS_USE_LEGACY_CLIENT=ON && make

FROM ubuntu:23.10

# Copy the build artificat.
COPY --from=build /app/build/bin /app
COPY --from=build /usr/local/lib/lib* /usr/local/lib/
COPY --from=build /app/build/libs/libuv/libuv.s* /usr/local/lib/

RUN ldconfig

# Run.
ENTRYPOINT ["./app/ardos"]

0 comments on commit f01d7f0

Please sign in to comment.