From 81b3cd5d192f40abbe9decf3ec4a6e69eff4b2e9 Mon Sep 17 00:00:00 2001 From: "hexlocation's laptop (asiago)" Date: Fri, 29 Mar 2024 01:51:46 -0400 Subject: [PATCH] we can now build docker containers! --- Dockerfile | 9 +++++++-- scripts/docker_build.sh | 5 +++++ scripts/docker_run.sh | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 scripts/docker_build.sh create mode 100755 scripts/docker_run.sh diff --git a/Dockerfile b/Dockerfile index 0c34322..3bb6a41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,11 @@ COPY . /tmp RUN yarn install --production RUN yarn global add typescript RUN tsc -RUN cp /tmp/build/* /app +RUN mkdir /app +RUN cp -r /tmp/build/* /app +RUN cp -r /tmp/posts /app/default_posts +RUN cp -r /tmp/node_modules /app +RUN cp -r /tmp/templates /app/default_templates +COPY ./scripts/docker_run.sh /app/run.sh WORKDIR /app -CMD ["node","index.js"] +CMD ["/app/run.sh"] diff --git a/scripts/docker_build.sh b/scripts/docker_build.sh new file mode 100755 index 0000000..0625a94 --- /dev/null +++ b/scripts/docker_build.sh @@ -0,0 +1,5 @@ +# Disseminate Build Script +# This script builds disseminate into a docker container, using the dockerfile provided in the repository. + +cd .. +docker build . -t disseminate:latest diff --git a/scripts/docker_run.sh b/scripts/docker_run.sh new file mode 100755 index 0000000..6dd98fd --- /dev/null +++ b/scripts/docker_run.sh @@ -0,0 +1,19 @@ +# I'm so bad at bash scripting +if [ -z "$(find posts -mindepth 1 -maxdepth 1)" ]; then + echo '-------------' + echo 'Posts directory is empty, copying default...' + echo '-------------' + cp -r default_posts/* posts +fi +if [ -z "$(find templates -mindepth 1 -maxdepth 1)" ]; then + echo '-------------' + echo 'Template directory is empty, copying default...' + echo '-------------' + cp -r default_templates/* templates +fi + + +echo 'Starting...' +node index.js +echo 'Exiting...' +