Browse Source

Fix links

pull/1/head
Wesley Kerfoot 5 years ago
parent
commit
c60f0e1db1
  1. 2
      app/Dockerfile
  2. 17
      app/link.json
  3. 14
      app/run.sh

2
app/Dockerfile

@ -5,7 +5,7 @@ RUN apt-get update -y
RUN apt-get install -y python3-pip python3-dev build-essential
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash
RUN apt-get install -y sassc nodejs
RUN apt-get install -y sassc nodejs jq
RUN npm install -g uglifycss uglifyjs
COPY . ./src

17
app/link.json

@ -0,0 +1,17 @@
{
"type" : "links",
"links" :[
{
"type" : "links",
"title" : "test 1",
"href" : "https://wesk.tech",
"sub" : "wat"
},
{
"type" : "links",
"title" : "test 2",
"href" : "https://wesk.tech",
"sub" : "lolwat"
}
]
}

14
app/run.sh

@ -1,5 +1,16 @@
#! /bin/bash
function updateLinks() {
revision_id=$(curl http://$COUCHDB_USER:$COUCHDB_PASSWORD@127.0.0.1:5984/$COUCHDB_NAME/links | jq -r "._rev")
echo "$revision_id"
if [ $? == 0 ];
then
curl -XDELETE "http://$COUCHDB_USER:$COUCHDB_PASSWORD@127.0.0.1:5984/$COUCHDB_NAME/links?rev=$revision_id" || true
fi
curl -XPUT http://$COUCHDB_USER:$COUCHDB_PASSWORD@127.0.0.1:5984/$COUCHDB_NAME/links -d @link.json || true
}
curl 127.0.0.1:5984 2> /dev/null
while [ $? != 0 ]; do
curl 127.0.0.1:5984 2> /dev/null
@ -8,4 +19,7 @@ done
curl -XPUT http://$COUCHDB_USER:$COUCHDB_PASSWORD@127.0.0.1:5984/$COUCHDB_NAME || true
curl -XPUT http://$COUCHDB_USER:$COUCHDB_PASSWORD@127.0.0.1:5984/$COUCHDB_NAME/_design/blogPosts -d @/blogPosts.json || true
updateLinks
exec python3 "$@"

Loading…
Cancel
Save