32 lines
1.1 KiB
Docker
32 lines
1.1 KiB
Docker
# 2022-10-29 Hyperling
|
|
# Create website in node container and run it.
|
|
|
|
# Using Debian testing so that we use PHP >8. Otherwise the shebangs from
|
|
# the include files (#!/usr/bin/php) show up on the website.
|
|
FROM node:lts-slim
|
|
|
|
# Cache System Dependencies
|
|
RUN apt-get update && apt-get install -y git php-cli sudo curl procps
|
|
|
|
# Cache Node Dependencies
|
|
RUN mkdir -p /var/www/api
|
|
WORKDIR /var/www/api
|
|
RUN echo '{ "dependencies": { "express": ">=4.18.1 < 5.0.0" } }' > package.json
|
|
RUN npm install
|
|
|
|
# Install + Run Website
|
|
CMD cd /var/www/api && \
|
|
echo "Ensure symlink is properly deleted if it exists..." && \
|
|
ls -l website/files; rm -v website/files; sleep 0 && \
|
|
echo "Clone the website's Git repo..." && \
|
|
rm -rfv website && \
|
|
git clone https://git.hyperling.com/me/nodejs-website --branch=dev website && \
|
|
echo "Remove dummy files and replace with symlink..." && \
|
|
rm -rfv website/files && \
|
|
cd website && \
|
|
ln -sv ../files ./files && \
|
|
echo "Allow files under files/ to be ignored by Git..." && \
|
|
find ./files -exec git update-index --assume-unchanged {} \; && \
|
|
echo "Start website!" && \
|
|
./run.sh
|