Overengineered. Back to basics.
Rewrote gather-media in bash. Updated dockerfile accordingly.main
parent
ad1c6ae0b2
commit
79c106401f
@ -1,12 +1,14 @@
|
||||
FROM golang:latest as BUILD
|
||||
FROM alpine
|
||||
COPY gather-media.sh /bin/gather-media
|
||||
#FROM golang:latest as BUILD
|
||||
|
||||
WORKDIR /gather-media
|
||||
#WORKDIR /gather-media
|
||||
|
||||
COPY go.mod ./
|
||||
# COPY go.sum ./
|
||||
#COPY go.mod ./
|
||||
## COPY go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
#RUN go mod download
|
||||
|
||||
COPY *.go ./
|
||||
#COPY *.go ./
|
||||
|
||||
RUN go build -o /bin/gather-media
|
||||
#RUN go build -o /bin/gather-media
|
||||
|
@ -0,0 +1,13 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo "scanning $1 for attachments"
|
||||
noteName=$(echo $1|awk -F'/' '{print $(NF-1)}')
|
||||
|
||||
attachments=$(cat $1|egrep "\[\[(Resources\/attachments\/.*?)\]\]"|tr -d '![]'|awk -F'/' '{print $(NF)}')
|
||||
echo "Found Attachments:"
|
||||
echo $attachments
|
||||
|
||||
for a in $attachments; do
|
||||
# echo "find . -name $a -exec mv {} /tmp/blog/content/notes/$noteName/$a \;"
|
||||
find . -name $a -exec mv {} /tmp/blog/content/notes/$noteName/$a \;
|
||||
done
|
Loading…
Reference in New Issue