Skip to content

Commit

Permalink
Merge pull request #51 from joegasewicz/docker-#12
Browse files Browse the repository at this point in the history
docker #12
  • Loading branch information
joegasewicz authored Jun 21, 2024
2 parents aef01c2 + e8bc139 commit 0453569
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 9 deletions.
30 changes: 23 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ add_executable(forest_mq main.c

find_package(PkgConfig REQUIRED)


if (APPLE)
target_include_directories(
forest_mq
PRIVATE
Expand All @@ -30,11 +32,25 @@ target_include_directories(
/opt/homebrew/Cellar/gnutls/3.8.4/include
/opt/homebrew/Cellar/ulfius/2.7.15/include
)
elseif (UNIX)
target_include_directories(
forest_mq
PRIVATE
)
endif()

target_link_libraries(
forest_mq
PRIVATE
/opt/homebrew/Cellar/jansson/2.14/lib/libjansson.dylib
/opt/homebrew/Cellar/ulfius/2.7.15/lib/libulfius.dylib
)

if (APPLE)
target_link_libraries(
forest_mq
PRIVATE
/opt/homebrew/Cellar/jansson/2.14/lib/libjansson.dylib
/opt/homebrew/Cellar/ulfius/2.7.15/lib/libulfius.dylib
)
elseif(UNIX)
target_link_libraries(
forest_mq
PRIVATE
/opt/homebrew/Cellar/jansson/2.14/lib/libjansson.dylib
/opt/homebrew/Cellar/ulfius/2.7.15/lib/libulfius.dylib
)
endif ()
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#FROM --platform=linux/amd64 ubuntu:22.04
FROM ubuntu:22.04

WORKDIR /forestmq

COPY . .

RUN apt-get update
RUN apt-get -y install libjansson-dev
RUN apt-get -y install libjansson-dev
RUN apt-get -y install libmicrohttpd-dev
RUN apt-get -y install liborcania-dev
RUN apt-get -y install libulfius-dev
RUN apt-get -y install cmake


RUN mkdir build
RUN cd build
RUN cmake . .
RUN make

14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
IMG_NAME=bandnoticeboard/nottoboard:forestmq-0.1.2

# Development requirements
# This will install all the required development libraries on a Mac.
install_ulfius_mac:
Expand All @@ -9,3 +11,15 @@ install_ulfius_mac:

docs_init:
doxygen -g Doxyfile

docker-build:
docker build --no-cache --tag $(IMG_NAME) .

docker-run:
docker run --env-file ../.env --rm -p 8001:8001 $(IMG_NAME)

docker-push:
docker push $(IMG_NAME)

docker-remove:
docker rmi $(IMG_NAME)
4 changes: 2 additions & 2 deletions tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ static int start_server(FMQ_TCP *tcp)
fprintf(stderr, "Error starting ulfius server\n");
exit(EXIT_FAILURE);
}
// declare endpoints

ulfius_add_endpoint_by_val(&instance, "POST", "/consumer", NULL, 0, &callback_consumer, tcp->queue);
ulfius_add_endpoint_by_val(&instance, "POST", "/provider", NULL, 0, &callback_provider, tcp->queue);
// start ulfius framework

if (ulfius_start_framework(&instance) == U_OK)
{
printf("Starting server on http://localhost:%d\n", instance.port);
Expand Down

0 comments on commit 0453569

Please sign in to comment.