diff --git a/Dockerfile b/Dockerfile index ae3348f8..9769617b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,8 +33,6 @@ RUN \ if [ -z "$DRONE" ] ; then echo "runs outside of drone" && version="$(/script/git-rev.sh)" ; \ else version=${DRONE_TAG}${DRONE_BRANCH}${DRONE_PULL_REQUEST}-${DRONE_COMMIT:0:7}-$(date +%Y%m%d-%H:%M:%S) ; fi && \ echo "version=$version" && \ - statik --src=/build/backend/templates --dest=/build/backend/app -p templates -ns templates -f && \ - ls -la /build/backend/app/templates/statik.go && \ go build -o remark42 -ldflags "-X main.revision=${version} -s -w" ./app FROM node:12.16-alpine as build-frontend-deps @@ -71,6 +69,7 @@ ADD backend/scripts/import.sh /usr/local/bin/import RUN chmod +x /entrypoint.sh /usr/local/bin/backup /usr/local/bin/restore /usr/local/bin/import COPY --from=build-backend /build/backend/remark42 /srv/remark42 +COPY --from=build-backend /build/backend/templates /srv COPY --from=build-frontend /srv/frontend/public/ /srv/web RUN chown -R app:app /srv RUN ln -s /srv/remark42 /usr/bin/remark42 diff --git a/backend/app/templates/templates.go b/backend/app/templates/templates.go index 87acf132..9cbd1d6f 100644 --- a/backend/app/templates/templates.go +++ b/backend/app/templates/templates.go @@ -32,7 +32,7 @@ func NewFS() *FS { // ReadFile depends on statik achieve exists func (f *FS) ReadFile(path string) ([]byte, error) { if f.statik != nil { - return fs.ReadFile(f.statik, filepath.Join("/", path)) + return fs.ReadFile(f.statik, filepath.Join("/", path)) //nolint:gocritic // root folder is a requirement for statik } - return ioutil.ReadFile(filepath.Join("./", filepath.Clean(path))) + return ioutil.ReadFile(filepath.Clean(path)) }