generated from Fascinated/nextjs-13-template-with-tailwindcss
Merge pull request 'Add auto downloading of files' (#4) from development into master
All checks were successful
Publish Docker Image / docker (push) Successful in 1m39s
All checks were successful
Publish Docker Image / docker (push) Successful in 1m39s
Reviewed-on: #4
This commit is contained in:
commit
8f91eba0f7
@ -3,6 +3,9 @@ FROM node:lts-slim
|
||||
ENV NODE_ENV=production
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
RUN apt update
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt install wget -y
|
||||
|
||||
# Copy package.json and package-lock.json separately to fully utilize Docker layer caching
|
||||
COPY package.json ./
|
||||
COPY package-lock.json ./
|
||||
@ -24,4 +27,4 @@ ENV NODE_ENV=production
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the app
|
||||
CMD ["npm", "start"]
|
||||
CMD ["bash", "start.sh"]
|
@ -14,4 +14,4 @@ services:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- ./config.json:/usr/src/app/config.json:ro # The application config (Must be created before starting the service)
|
||||
#- ./public:/usr/src/app/public:ro # Used for public facing images (uncomment if you are using your own images - see the public directory)
|
||||
- ./public:/usr/src/app/public:rw # Used for public facing images (eg: avatar and background)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "simple-links",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
28
start.sh
Normal file
28
start.sh
Normal file
@ -0,0 +1,28 @@
|
||||
workDir=/usr/src/app
|
||||
|
||||
baseUrl=https://git.fascinated.cc/Fascinated/simple-links/raw/branch/master/public/
|
||||
toDownload=("avatar.webp" "background.jpg")
|
||||
|
||||
echo "Checking if files need to be downloaded"
|
||||
if [ -z "$(ls -A $workDir/public)" ]; then
|
||||
echo "Some files are missing, downloading them"
|
||||
if [ ! -w "$workDir" ]; then
|
||||
# TODO: fix this. it doesn't seem to be working?
|
||||
echo "The directory \"$workDir\" is not writeable, unable to download files. Please check your docker compose for :ro and set it to :rw"
|
||||
fi
|
||||
for item in "${toDownload[@]}"
|
||||
do
|
||||
dir=$workDir/public/$item
|
||||
if [ ! -e "$dir" ]; then
|
||||
echo "Downloading $item to directory $dir"
|
||||
wget -q -P $dir $baseUrl$item
|
||||
echo "Done"
|
||||
fi
|
||||
done
|
||||
echo "Finished downloading files!"
|
||||
else
|
||||
echo "All files are already present, no need to download"
|
||||
fi
|
||||
|
||||
echo "Starting Simple Links..."
|
||||
npm start
|
Loading…
x
Reference in New Issue
Block a user