we can now build docker containers!

This commit is contained in:
hexlocation's laptop (asiago) 2024-03-29 01:51:46 -04:00
parent 7c89da0baf
commit 81b3cd5d19
3 changed files with 31 additions and 2 deletions

View file

@ -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"]

5
scripts/docker_build.sh Executable file
View file

@ -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

19
scripts/docker_run.sh Executable file
View file

@ -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...'