diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..12b0c3d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,34 @@ +FROM alpine:edge + +RUN apk add --no-cache git +RUN apk add --no-cache musl-dev +RUN apk add --no-cache gcc +RUN apk add --no-cache sqlite +RUN apk add --no-cache go +RUN apk add --no-cache make +RUN apk add --no-cache npm +RUN apk add --no-cache yarn + +VOLUME /app/var +EXPOSE 5673 + +ARG gomaxprocs="8" + +WORKDIR /app + +ENV SRC_DIR=/app/src/ + +ENV GOMAXPROCS=${gomaxprocs} + +RUN git clone https://code.chrissexton.org/cws/cabinet.git $SRC_DIR + +RUN apk add --no-cache tzdata +ENV TZ America/New_York + +# RUN yarn global add @vue/cli +RUN cd $SRC_DIR/frontend; yarn && yarn build +RUN go get -u github.com/gobuffalo/packr/v2/packr2 +RUN cd $SRC_DIR; $HOME/go/bin/packr2 +RUN cd $SRC_DIR; go get ./...; go build -o /app/cabinet + +ENTRYPOINT ["/app/cabinet", "-httpAddr=0.0.0.0:5673", "-db=/app/var/cabinet.db"] diff --git a/entry/entry.go b/entry/entry.go index 18a46d1..0b39b9b 100644 --- a/entry/entry.go +++ b/entry/entry.go @@ -52,6 +52,14 @@ func PrepareTable(tx *sqlx.Tx) error { return nil } +func NewFromMd(db *db.Database, body string) *Entry { + e := New(db) + e.Content = body + e.Title = e.GenerateTitle() + e.Slug = e.UniqueSlug() + return e +} + func New(db *db.Database) *Entry { e := Entry{ db: db, diff --git a/frontend/package.json b/frontend/package.json index b473c40..c84d2f0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,8 +11,11 @@ "@vue/cli": "^4.0.5", "asciidoctor": "^2.0.3", "axios": "^0.19.0", + "jquery": "^1.9.1", + "popper.js": "^1.14.7", "bootstrap": "^4.3.1", "bootstrap-vue": "^2.0.4", + "bootswatch": "^4.3.1", "brace": "latest", "core-js": "^3.3.2", "lodash": "^4.17.15", @@ -30,6 +33,9 @@ "babel-eslint": "^10.0.3", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", + "sass": "^1.23.0", + "sass-loader": "^8.0.0", + "webpack": "^4.36.0", "vue-template-compiler": "^2.6.10" } } diff --git a/frontend/public/index.html b/frontend/public/index.html index 1fe8d73..e747196 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -5,7 +5,7 @@ -