From 14d515fe70b0a338efc3a571f82190d3c34826d6 Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Thu, 10 Mar 2022 20:27:25 -0500 Subject: Wire up with docker-compose --- .dockerignore | 10 ++++++++++ Dockerfile | 18 +++++++----------- Makefile | 2 +- docker-compose.yml | 27 +++++++++++++++++++++++++++ src/clog.c | 2 +- 5 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 .dockerignore create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6fe2e26 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +cert/ +clog.so +.env +.git/ +.gitignore +.objs/ +sandbox/ +.venv/ +.vols/ +.vscode/ diff --git a/Dockerfile b/Dockerfile index 03d0df6..c043e20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,10 @@ MAINTAINER Michael McVady RUN set -e \ && apk add --no-cache \ - busybox-extras + busybox-extras \ + libpq -# COPY . /clog +COPY . /clog RUN set -e \ && mkdir -p /var/chroot \ @@ -28,18 +29,13 @@ RUN set -e \ && make NOTLS=1 PGSQL=1 \ && make install \ && cd .. \ - && rm -rf kore-4.1.0* - -COPY . /clog - -RUN set -e \ + && rm -rf kore-4.1.0* \ && cd /clog \ - && kodev build -# && apk del .build-deps + && kodev build \ + && apk del .build-deps EXPOSE 8888 STOPSIGNAL SIGQUIT WORKDIR /clog -# ENTRYPOINT [ "kore", "-c", "conf/clog.conf", "-r", "-n", "-f"] -ENTRYPOINT [ "kodev", "run"] +ENTRYPOINT [ "kore", "-c", "conf/clog.conf", "-r", "-n", "-f"] diff --git a/Makefile b/Makefile index 3e26ce0..dbc3149 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ clean: docker rmi -f clog:latest docker-build: - docker build -t clog . + DOCKER_BUILDKIT=1 docker build -t clog . docker-run: docker rm -f clog diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e9d0ec9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: "2" + +services: + + clog: + container_name: clog + image: clog:latest + build: . + ports: + - "8888:8888" + environment: + - POSTGRES_PASSWORD=postgres + depends_on: + - postgres + + postgres: + container_name: clog-postgres + image: postgres:12-alpine + volumes: + - .vols/database:/var/lib/postgresql/data + ports: + - "5555:5432" + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=clog + diff --git a/src/clog.c b/src/clog.c index b6c3cb1..36f0a96 100644 --- a/src/clog.c +++ b/src/clog.c @@ -32,7 +32,7 @@ init(int state) // Register the database int err = kore_pgsql_register( database, - "host=127.0.0.1 port=5432 user=postgres password=p0stgres dbname=clog sslmode=disable" + "host=postgres port=5432 user=postgres password=postgres dbname=clog sslmode=disable" ); return err; } -- cgit v1.2.3