From 6e70e4295e8b575f9854c606977e5f131106d3da Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Fri, 19 Jul 2024 17:30:33 -0400 Subject: [PATCH] compile server exe in docker and export to /bin/ --- .gitignore | 3 +++ README.md | 21 ++++++++++++++++++--- bin.dockerfile | 12 ++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 bin.dockerfile diff --git a/.gitignore b/.gitignore index 046933f..5e8d813 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,9 @@ htmldocs/ # file uploads directory uploads/ +# docker build directory +bin/ + # database *.db diff --git a/README.md b/README.md index 7cfdda7..e881928 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,27 @@ nimble install jester norm checksums Compile and run: ```sh -nimble run --deepcopy:on +nimble run ``` -More verbose compilation: +Build project: + ```sh -nimble run --deepcopy:on --verbose -d:normDebug --spellSuggest +nimble build +``` + +## Docker + +To compile the binary only, run the following (executable will be found in `/bin/`): + +```sh +docker buildx build -t glimpse-server:latest --output=bin --target=runner -f +``` + +To deploy an instance of the server, run: + +```sh + ``` ## API Endpoints diff --git a/bin.dockerfile b/bin.dockerfile new file mode 100644 index 0000000..f841899 --- /dev/null +++ b/bin.dockerfile @@ -0,0 +1,12 @@ +FROM nimlang/nim:latest AS builder +WORKDIR /src +COPY . /src + +RUN apt-get -y update && apt-get -y upgrade && apt-get -y autoremove + +RUN nimble -y install jester norm checksums +RUN nimble build + +FROM scratch AS runner + +COPY --from=builder /src/server . \ No newline at end of file