Websoft9 / docker-library

Docker Compose examples of selfhosted FOSS based on official image, just run it.
https://www.websoft9.com
Other
30 stars 14 forks source link

runtime restart problem #623

Open chendelin1982 opened 3 weeks ago

chendelin1982 commented 3 weeks ago

What type of your feature request?

when runtime restart, cmd.sh execute again

qiaofeng1227 commented 3 weeks ago

need to condition:

  1. mounted source
  2. If source in container, not update by cmd.sh
npm install express --save
if [ ! -f app.js ]; then
  cat > app.js <<EOF
const express = require('express')
const app = express()
const port = 8080

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(\`Example app listening on port \${port}\`)
})
EOF
  echo "app.js has been created."
else
  echo "app.js already exists."
fi
node app.js