Skip to content

Commit

Permalink
fix: more dockerfile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Jul 2, 2024
1 parent a598ee0 commit 619473c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
25 changes: 17 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine as client
FROM node:22-alpine as client
WORKDIR /app
COPY ./client .
RUN yarn install
Expand All @@ -11,15 +11,24 @@ COPY ./server .
RUN apt-get update && apt-get install -y
RUN cargo install --path . --locked

FROM debian:bullseye-slim
FROM debian:bullseye-slim as or-tools
RUN mkdir -p /algorithms/src/routing/plugins
RUN apt-get update && apt-get install -y
RUN apt install -y build-essential cmake lsb-release
RUN apt install -y curl build-essential cmake lsb-release
RUN ldconfig
COPY ./or-tools/src ./src
RUN curl -L https://github.com/google/or-tools/releases/download/v9.10/or-tools_amd64_debian-11_cpp_v9.10.4067.tar.gz -o ortools.tar.gz
RUN cat ortools.tar.gz | tar -xzf - && \
mv or-tools_* source && \
cd source && \
mv /src/tsp/ ./examples/koji_tsp && \
make build SOURCE=examples/koji_tsp/koji_tsp.cc && \
mv ./examples/koji_tsp/build/bin/koji_tsp /algorithms/src/routing/plugins/tsp

FROM debian:bullseye-slim
COPY --from=or-tools /algorithms .
COPY --from=or-tools /source .
COPY --from=client /app/dist ./dist
COPY --from=server /usr/local/cargo/bin/koji /usr/local/bin/koji
RUN apt install curl -y
RUN apt install -y build-essential cmake lsb-release
RUN mkdir -p /algorithms/src/routing/plugins
COPY ./or-tools .
RUN ./or-tools/install.sh

CMD koji
18 changes: 12 additions & 6 deletions or-tools/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

# add output as the first arg
os=$OSTYPE
cpu=$(uname -p)
minor_version="9.10"
Expand Down Expand Up @@ -40,10 +40,16 @@ if [ ! -d "${full_version}" ]; then
fi

# check if folder exists and remove if so
if [ -d "./${full_version}/examples/koji-tsp" ]; then
rm -r ./${full_version}/examples/koji-tsp
if [ -d "./${full_version}/examples/koji_tsp" ]; then
rm -r ./${full_version}/examples/koji_tsp
fi
cp -r ./src/tsp ./${full_version}/examples/koji-tsp
cp -r ./src/tsp ./${full_version}/examples/koji_tsp
cd $full_version
make build SOURCE=examples/koji-tsp/koji-tsp.cc
mv ./examples/koji-tsp/build/bin/koji-tsp ../../server/algorithms/src/routing/plugins/tsp
make build SOURCE=examples/koji_tsp

if [ $# -eq 0 ]; then
echo hi
# mv ./examples/koji_tsp/build/bin/koji_tsp ../../server/algorithms/src/routing/plugins/tsp
# else
# mv ./${full_version}/examples/koji_tsp/build/bin/koji_tsp /algorithms/src/routing/plugins/tsp
fi
7 changes: 2 additions & 5 deletions or-tools/src/tsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ cmake_minimum_required(VERSION 3.18)

option(CMAKE_EXPORT_COMPILE_COMMANDS "Export compile command" OFF)

project(koji-tsp VERSION 1.0 LANGUAGES CXX)
project(koji_tsp VERSION 1.0 LANGUAGES CXX)
message(STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}")
#message(STATUS "major: ${PROJECT_VERSION_MAJOR}")
#message(STATUS "minor: ${PROJECT_VERSION_MINOR}")
#message(STATUS "patch: ${PROJECT_VERSION_PATCH}")

if(MSVC)
set(CMAKE_CXX_STANDARD 20)
Expand Down Expand Up @@ -68,7 +65,7 @@ endif()

find_package(ortools REQUIRED CONFIG)

add_executable(${PROJECT_NAME} koji-tsp.cc memory_limit.cc)
add_executable(${PROJECT_NAME} koji_tsp.cc memory_limit.cc)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
#target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
target_link_libraries(${PROJECT_NAME} PRIVATE ortools::ortools)
Expand Down
File renamed without changes.

0 comments on commit 619473c

Please sign in to comment.