parent
f5826d1950
commit
d545fa9433
@ -0,0 +1,50 @@
|
|||||||
|
linters-settings:
|
||||||
|
maligned:
|
||||||
|
suggest-new: true
|
||||||
|
misspell:
|
||||||
|
locale: US
|
||||||
|
|
||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- bodyclose
|
||||||
|
- deadcode
|
||||||
|
- dogsled
|
||||||
|
- dupl
|
||||||
|
- errcheck
|
||||||
|
- gochecknoglobals
|
||||||
|
- gochecknoinits
|
||||||
|
- gocognit
|
||||||
|
- goconst
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- goimports
|
||||||
|
- golint
|
||||||
|
- gosec
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- interfacer
|
||||||
|
- maligned
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- prealloc
|
||||||
|
- rowserrcheck
|
||||||
|
- scopelint
|
||||||
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
|
- typecheck
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
- whitespace
|
||||||
|
|
||||||
|
run:
|
||||||
|
skip-dirs:
|
||||||
|
- .devcontainer
|
||||||
|
- .github
|
||||||
|
- postgres
|
||||||
|
|
||||||
|
service:
|
||||||
|
golangci-lint-version: 1.27.x # use the fixed version to not introduce new linters unexpectedly
|
@ -1,63 +1,66 @@
|
|||||||
ARG ALPINE_VERSION=3.12
|
ARG ALPINE_VERSION=3.12
|
||||||
ARG GO_VERSION=1.14
|
ARG GO_VERSION=1.14
|
||||||
ARG STACKEDIT_VERSION=v5.14.5
|
ARG STACKEDIT_VERSION=v5.14.5
|
||||||
|
|
||||||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS server
|
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS server
|
||||||
RUN apk --update add git
|
RUN apk --update add git
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
WORKDIR /tmp/gobuild
|
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s ${GOLANGCI_LINT_VERSION}
|
||||||
COPY go.mod go.sum ./
|
WORKDIR /tmp/gobuild
|
||||||
RUN go mod download 2>&1
|
COPY .golangci.yml .
|
||||||
COPY main.go ./
|
COPY go.mod go.sum ./
|
||||||
#RUN go test -v -race ./...
|
RUN go mod download 2>&1
|
||||||
|
COPY main.go ./
|
||||||
|
#RUN go test -v -race ./...
|
||||||
|
RUN golangci-lint run --timeout=10m
|
||||||
RUN go build -ldflags="-s -w" -o app main.go
|
RUN go build -ldflags="-s -w" -o app main.go
|
||||||
|
|
||||||
FROM --platform=amd64 alpine:${ALPINE_VERSION} AS stackedit
|
FROM --platform=amd64 alpine:${ALPINE_VERSION} AS stackedit
|
||||||
ARG STACKEDIT_VERSION
|
ARG STACKEDIT_VERSION
|
||||||
WORKDIR /stackedit
|
WORKDIR /stackedit
|
||||||
RUN apk add -q --progress --update --no-cache git npm python2
|
RUN apk add -q --progress --update --no-cache git npm python2
|
||||||
RUN wget -q https://github.com/benweet/stackedit/archive/${STACKEDIT_VERSION}.tar.gz -O stackedit.tar.gz && \
|
RUN wget -q https://github.com/benweet/stackedit/archive/${STACKEDIT_VERSION}.tar.gz -O stackedit.tar.gz && \
|
||||||
tar -xzf stackedit.tar.gz --strip-components=1 && \
|
tar -xzf stackedit.tar.gz --strip-components=1 && \
|
||||||
rm stackedit.tar.gz
|
rm stackedit.tar.gz
|
||||||
RUN npm install
|
RUN npm install
|
||||||
RUN npm audit fix
|
RUN npm audit fix
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
RUN sed -i "s/assetsPublicPath: '\/',/assetsPublicPath: '.\/',/g" config/index.js && cat config/index.js
|
RUN sed -i "s/assetsPublicPath: '\/',/assetsPublicPath: '.\/',/g" config/index.js && cat config/index.js
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM scratch AS final
|
FROM scratch AS final
|
||||||
ARG BUILD_DATE
|
ARG BUILD_DATE
|
||||||
ARG VCS_REF
|
ARG VCS_REF
|
||||||
ARG STACKEDIT_VERSION
|
ARG STACKEDIT_VERSION
|
||||||
LABEL \
|
LABEL \
|
||||||
org.opencontainers.image.authors="quentin.mcgaw@gmail.com" \
|
org.opencontainers.image.authors="quentin.mcgaw@gmail.com" \
|
||||||
org.opencontainers.image.created=$BUILD_DATE \
|
org.opencontainers.image.created=$BUILD_DATE \
|
||||||
org.opencontainers.image.version=$STACKEDIT_VERSION \
|
org.opencontainers.image.version=$STACKEDIT_VERSION \
|
||||||
org.opencontainers.image.revision=$VCS_REF \
|
org.opencontainers.image.revision=$VCS_REF \
|
||||||
org.opencontainers.image.url="https://github.com/qdm12/stackedit-docker" \
|
org.opencontainers.image.url="https://github.com/qdm12/stackedit-docker" \
|
||||||
org.opencontainers.image.documentation="https://github.com/qdm12/stackedit-docker/blob/master/README.md" \
|
org.opencontainers.image.documentation="https://github.com/qdm12/stackedit-docker/blob/master/README.md" \
|
||||||
org.opencontainers.image.source="https://github.com/qdm12/stackedit-docker" \
|
org.opencontainers.image.source="https://github.com/qdm12/stackedit-docker" \
|
||||||
org.opencontainers.image.title="stackedit-docker" \
|
org.opencontainers.image.title="stackedit-docker" \
|
||||||
org.opencontainers.image.description="StackEdit server in a lightweight Docker container"
|
org.opencontainers.image.description="StackEdit server in a lightweight Docker container"
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
HEALTHCHECK --start-period=1s --interval=100s --timeout=2s --retries=1 CMD ["/server","healthcheck"]
|
HEALTHCHECK --start-period=1s --interval=100s --timeout=2s --retries=1 CMD ["/server","healthcheck"]
|
||||||
USER 1000
|
USER 1000
|
||||||
ENTRYPOINT ["/server"]
|
ENTRYPOINT ["/server"]
|
||||||
ENV \
|
ENV \
|
||||||
LISTENING_PORT=8000 \
|
LISTENING_PORT=8000 \
|
||||||
ROOT_URL=/ \
|
ROOT_URL=/ \
|
||||||
NODE_ENV=production \
|
NODE_ENV=production \
|
||||||
PANDOC_PATH=pandoc \
|
PANDOC_PATH=pandoc \
|
||||||
WKHTMLTOPDF_PATH=wkhtmltopdf \
|
WKHTMLTOPDF_PATH=wkhtmltopdf \
|
||||||
USER_BUCKET_NAME=stackedit-users \
|
USER_BUCKET_NAME=stackedit-users \
|
||||||
PAYPAL_RECEIVER_EMAIL= \
|
PAYPAL_RECEIVER_EMAIL= \
|
||||||
DROPBOX_APP_KEY= \
|
DROPBOX_APP_KEY= \
|
||||||
DROPBOX_APP_KEY_FULL= \
|
DROPBOX_APP_KEY_FULL= \
|
||||||
GITHUB_CLIENT_ID= \
|
GITHUB_CLIENT_ID= \
|
||||||
GITHUB_CLIENT_SECRET= \
|
GITHUB_CLIENT_SECRET= \
|
||||||
GOOGLE_CLIENT_ID= \
|
GOOGLE_CLIENT_ID= \
|
||||||
GOOGLE_API_KEY= \
|
GOOGLE_API_KEY= \
|
||||||
WORDPRESS_CLIENT_ID=
|
WORDPRESS_CLIENT_ID=
|
||||||
COPY --from=stackedit --chown=1000 /stackedit/dist /html/dist
|
COPY --from=stackedit --chown=1000 /stackedit/dist /html/dist
|
||||||
COPY --from=stackedit --chown=1000 /stackedit/static /html/static
|
COPY --from=stackedit --chown=1000 /stackedit/static /html/static
|
||||||
COPY --from=server --chown=1000 /tmp/gobuild/app /server
|
COPY --from=server --chown=1000 /tmp/gobuild/app /server
|
||||||
|
Loading…
Reference in new issue