diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 19:52:29 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-28 20:29:03 +0200 |
commit | 1b9bdac6d2b5c7f7911245947e903a3df3c04145 (patch) | |
tree | b6129fc86c171349803bd828e4e10fd7a710c637 | |
parent | make proper "error" messages (diff) | |
download | cimple-1b9bdac6d2b5c7f7911245947e903a3df3c04145.tar.gz cimple-1b9bdac6d2b5c7f7911245947e903a3df3c04145.zip |
docker: add initial configuration
-rw-r--r-- | .dockerignore | 5 | ||||
-rw-r--r-- | Dockerfile | 36 | ||||
-rw-r--r-- | docker-compose.yml | 25 |
3 files changed, 66 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9c6fc5c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +* + +!/CMakeLists.txt +!/LICENSE.txt +!/src/** diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..368524b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM alpine:3.16 AS base + +ARG install_dir="/app/install" + +FROM base AS builder + +RUN apk add --no-cache bsd-compat-headers build-base clang cmake libgit2-dev + +ARG src_dir="/app/src" +ARG build_dir="/app/build" +ARG install_dir + +COPY [".", "$src_dir"] + +RUN mkdir -- "$build_dir" && \ + cd -- "$build_dir" && \ + cmake \ + -D CMAKE_C_COMPILER=clang \ + -D CMAKE_BUILD_TYPE=Release \ + -D "CMAKE_INSTALL_PREFIX=$install_dir" \ + "$src_dir" && \ + make -j install + +FROM base + +LABEL maintainer="Egor Tensin <Egor.Tensin@gmail.com>" + +RUN apk add --no-cache tini libgit2 + +ARG install_dir +COPY --from=builder ["$install_dir", "$install_dir"] + +WORKDIR "$install_dir/bin" + +ENTRYPOINT ["/sbin/tini", "--"] +CMD ["./cimple-server"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d80a5cd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3' + +x-cimple: &common + build: . + image: egortensin/cimple + restart: always + +services: + server: + <<: *common + ports: + - 5556 + worker1: + <<: *common + command: ["./cimple-worker", "--host", "server"] + depends_on: [server] + worker2: + <<: *common + command: ["./cimple-worker", "--host", "server"] + depends_on: [server] + client: + <<: *common + command: [] + entrypoint: ["./cimple-client", "--host", "server"] + restart: 'no' |