workspaces
@@ -2,7 +2,8 @@
|
||||
/target/
|
||||
/var/
|
||||
/frontend/node_modules/
|
||||
/frontend/public/
|
||||
/frontend/apps/remark42/node_modules/
|
||||
/frontend/apps/remark42/public/
|
||||
/.vscode/
|
||||
/.idea/
|
||||
/bin/
|
||||
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/ci-frontend-size-limit.yml"
|
||||
- "frontend/**"
|
||||
- "frontend/apps/remark42/**"
|
||||
- "!**.md"
|
||||
|
||||
jobs:
|
||||
@@ -27,4 +27,4 @@ jobs:
|
||||
uses: andresz1/size-limit-action@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
directory: frontend
|
||||
directory: ./frontend/apps/remark42
|
||||
|
||||
@@ -6,12 +6,12 @@ on:
|
||||
tags:
|
||||
paths:
|
||||
- ".github/workflows/ci-frontend.yml"
|
||||
- "frontend/**"
|
||||
- "frontend/apps/remark42/**"
|
||||
- "!**.md"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/ci-frontend.yml"
|
||||
- "frontend/**"
|
||||
- "frontend/apps/remark42/**"
|
||||
- "!**.md"
|
||||
|
||||
jobs:
|
||||
@@ -55,8 +55,8 @@ jobs:
|
||||
working-directory: ./frontend
|
||||
|
||||
- name: Run translations check
|
||||
run: pnpm run check:translation
|
||||
working-directory: ./frontend
|
||||
run: pnpm translation-check
|
||||
working-directory: ./frontend/apps/remark42
|
||||
|
||||
check-typescript:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -98,8 +98,8 @@ jobs:
|
||||
working-directory: ./frontend
|
||||
|
||||
- name: Run type check
|
||||
run: pnpm run check:types
|
||||
working-directory: ./frontend
|
||||
run: pnpm type-check
|
||||
working-directory: ./frontend/apps/remark42
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -141,8 +141,8 @@ jobs:
|
||||
working-directory: ./frontend
|
||||
|
||||
- name: Run linters
|
||||
run: pnpm run lint
|
||||
working-directory: ./frontend
|
||||
run: pnpm lint
|
||||
working-directory: ./frontend/apps/remark42
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -185,9 +185,9 @@ jobs:
|
||||
|
||||
- name: Collect tests coverage
|
||||
run: pnpm run test --coverage
|
||||
working-directory: ./frontend
|
||||
working-directory: ./frontend/apps/remark42
|
||||
|
||||
- name: Submit coverage
|
||||
run: ${{ github.workspace }}/frontend/node_modules/.bin/codecov
|
||||
run: ${{ github.workspace }}/frontend/apps/remark42/node_modules/.bin/codecov
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@@ -1,4 +1,51 @@
|
||||
FROM umputun/baseimage:buildgo-v1.9.2 as build-backend
|
||||
FROM --platform=$BUILDPLATFORM node:16.15.1-alpine AS frontend-deps
|
||||
|
||||
ARG SKIP_FRONTEND_TEST
|
||||
ARG SKIP_FRONTEND_BUILD
|
||||
|
||||
WORKDIR /srv/frontend/
|
||||
|
||||
COPY ./frontend/package.json ./frontend/pnpm-lock.yaml ./frontend/pnpm-workspace.yaml /srv/frontend/
|
||||
COPY ./frontend/apps/remark42/package.json /srv/frontend/apps/remark42/
|
||||
|
||||
RUN \
|
||||
if [[ -z "$SKIP_FRONTEND_BUILD" || -z "$SKIP_FRONTEND_TEST" ]]; then \
|
||||
apk add --no-cache --update git && \
|
||||
npm i -g pnpm; \
|
||||
fi
|
||||
|
||||
RUN --mount=type=cache,id=pnpm,target=/root/.pnpm-store/v3 \
|
||||
if [[ -z "$SKIP_FRONTEND_BUILD" || -z "$SKIP_FRONTEND_TEST" ]]; then \
|
||||
pnpm i; \
|
||||
fi
|
||||
|
||||
|
||||
FROM --platform=$BUILDPLATFORM frontend-deps AS build-frontend
|
||||
|
||||
ARG SKIP_FRONTEND_TEST
|
||||
ARG SKIP_FRONTEND_BUILD
|
||||
ENV CI=true
|
||||
|
||||
WORKDIR /srv/frontend/apps/remark42/
|
||||
|
||||
COPY ./frontend/apps/remark42/ /srv/frontend/apps/remark42/
|
||||
|
||||
RUN \
|
||||
if [ -z "$SKIP_FRONTEND_TEST" ]; then \
|
||||
pnpm lint type-check translation-check test; \
|
||||
else \
|
||||
echo 'Skip frontend test'; \
|
||||
fi
|
||||
|
||||
RUN \
|
||||
if [ -z "$SKIP_FRONTEND_BUILD" ]; then \
|
||||
pnpm build; \
|
||||
else \
|
||||
mkdir /srv/frontend/apps/remark42/public; \
|
||||
echo 'Skip frontend build'; \
|
||||
fi
|
||||
|
||||
FROM umputun/baseimage:buildgo-v1.9.1 as build-backend
|
||||
|
||||
ARG CI
|
||||
ARG GITHUB_REF
|
||||
@@ -25,7 +72,7 @@ RUN \
|
||||
cat /profile.cov_tmp | grep -v "_mock.go" > /profile.cov ; \
|
||||
golangci-lint run --config ../.golangci.yml ./... ; \
|
||||
else \
|
||||
echo "skip backend tests and linter" \
|
||||
echo "skip backend tests and linter" \
|
||||
; fi
|
||||
|
||||
RUN \
|
||||
@@ -33,57 +80,6 @@ RUN \
|
||||
echo "version=$version" && \
|
||||
go build -o remark42 -ldflags "-X main.revision=${version} -s -w" ./app
|
||||
|
||||
FROM --platform=$BUILDPLATFORM node:16.15.1-alpine as build-frontend-deps
|
||||
|
||||
ARG CI
|
||||
ARG SKIP_FRONTEND_BUILD
|
||||
ARG SKIP_FRONTEND_TEST
|
||||
ENV HUSKY_SKIP_INSTALL=true
|
||||
|
||||
WORKDIR /srv/frontend
|
||||
COPY frontend/package.json frontend/pnpm-lock.yaml /srv/frontend/
|
||||
RUN \
|
||||
if [[ -z "$SKIP_FRONTEND_BUILD" || -z "$SKIP_FRONTEND_TEST" ]]; then \
|
||||
apk add --no-cache --update git && \
|
||||
npm i -g pnpm; \
|
||||
fi
|
||||
|
||||
RUN --mount=type=cache,id=pnpm,target=/root/.pnpm-store/v3 \
|
||||
if [[ -z "$SKIP_FRONTEND_BUILD" || -z "$SKIP_FRONTEND_TEST" ]]; then \
|
||||
pnpm i; \
|
||||
fi
|
||||
|
||||
FROM --platform=$BUILDPLATFORM node:16.15.1-alpine as build-frontend
|
||||
|
||||
ARG CI
|
||||
ARG SKIP_FRONTEND_TEST
|
||||
ARG SKIP_FRONTEND_BUILD
|
||||
ARG NODE_ENV=production
|
||||
|
||||
COPY --from=build-frontend-deps /srv/frontend/node_modules /srv/frontend/node_modules
|
||||
COPY ./frontend /srv/frontend
|
||||
WORKDIR /srv/frontend
|
||||
RUN \
|
||||
if [[ -z "$SKIP_FRONTEND_BUILD" || -z "$SKIP_FRONTEND_TEST" ]]; then \
|
||||
apk add --no-cache --update git && \
|
||||
npm i -g pnpm; \
|
||||
fi
|
||||
|
||||
RUN \
|
||||
if [ -z "$SKIP_FRONTEND_TEST" ]; then \
|
||||
pnpm lint test check; \
|
||||
else \
|
||||
echo 'Skip frontend test'; \
|
||||
fi
|
||||
|
||||
RUN \
|
||||
if [ -z "$SKIP_FRONTEND_BUILD" ]; then \
|
||||
pnpm build; \
|
||||
else \
|
||||
mkdir -p public; \
|
||||
echo 'Skip frontend build'; \
|
||||
fi
|
||||
|
||||
FROM umputun/baseimage:app-v1.9.2
|
||||
|
||||
WORKDIR /srv
|
||||
@@ -96,7 +92,7 @@ RUN chmod +x /entrypoint.sh /usr/local/bin/backup /usr/local/bin/restore /usr/lo
|
||||
|
||||
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
|
||||
COPY --from=build-frontend /srv/frontend/apps/remark42/public/ /srv/web/
|
||||
COPY docker-init.sh /srv/init.sh
|
||||
RUN chown -R app:app /srv
|
||||
RUN ln -s /srv/remark42 /usr/bin/remark42
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
FROM node:16.15.1-alpine as build-frontend-deps
|
||||
|
||||
ARG CI
|
||||
FROM node:16.15.1-alpine AS frontend-deps
|
||||
|
||||
ENV CI=true
|
||||
|
||||
ADD frontend/package.json /srv/frontend/package.json
|
||||
ADD frontend/pnpm-lock.yaml /srv/frontend/pnpm-lock.yaml
|
||||
WORKDIR /srv/frontend
|
||||
RUN
|
||||
apk add --no-cache --update git && \
|
||||
npm i -g pnpm && \
|
||||
pnpm i
|
||||
|
||||
FROM node:16.15.1-alpine as build-frontend
|
||||
COPY ./frontend/package.json ./frontend/pnpm-lock.yaml ./frontend/pnpm-workspace.yaml /srv/frontend
|
||||
COPY ./frontend/apps/remark42/package.json /srv/frontend/apps/remark42/package.json
|
||||
|
||||
ARG CI
|
||||
ARG NODE_ENV=production
|
||||
ENV HUSKY_SKIP_INSTALL=true
|
||||
RUN apk add --no-cache --update git && npm i -g pnpm
|
||||
RUN --mount=type=cache,id=pnpm,target=/root/.pnpm-store/v3 pnpm i
|
||||
|
||||
COPY --from=build-frontend-deps /srv/frontend/node_modules /srv/frontend/node_modules
|
||||
WORKDIR /srv/frontend
|
||||
RUN npm run build && \
|
||||
rm -rf ./node_modules
|
||||
FROM frontend-deps AS build-frontend
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV CI=true
|
||||
|
||||
WORKDIR /srv/frontend/apps/remark42/
|
||||
COPY ./frontend/apps/remark42/ /srv/frontend/apps/remark42/
|
||||
RUN pnpm build
|
||||
|
||||
FROM umputun/baseimage:buildgo-v1.9.2 as build-backend
|
||||
|
||||
@@ -34,7 +30,7 @@ ADD backend /build/backend
|
||||
ADD README.md /build/
|
||||
ADD LICENSE /build/
|
||||
|
||||
COPY --from=build-frontend /srv/frontend/public/ web
|
||||
COPY --from=build-frontend /srv/frontend/apps/remark42/public/ /build/backend/web/
|
||||
|
||||
RUN \
|
||||
export WEB_ROOT=/build/backend/web && \
|
||||
@@ -46,7 +42,7 @@ RUN \
|
||||
ls -la /build/backend/web/
|
||||
|
||||
RUN \
|
||||
version=$("/script/version.sh") && echo "version=${version}" && \
|
||||
version=$("/script/version.sh") && echo "version=${version}" && \
|
||||
export GOFLAGS="-mod=vendor" && \
|
||||
GOOS=linux GOARCH=amd64 go build -o remark42.linux-amd64 -ldflags "-X main.revision=${version} -s -w" ./app && \
|
||||
GOOS=linux GOARCH=386 go build -o remark42.linux-386 -ldflags "-X main.revision=${version} -s -w" ./app && \
|
||||
|
||||
@@ -5,3 +5,4 @@ public
|
||||
.env
|
||||
tsconfig.tsbuildinfo
|
||||
coverage
|
||||
!remark42
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
# .husky/post-commit
|
||||
|
||||
cd frontend
|
||||
git update-index --again
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# .husky/pre-commit
|
||||
npx --no-install lint-staged
|
||||
lint-staged
|
||||
|
||||
cd frontend
|
||||
pnpm lint-staged
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
module.exports = {
|
||||
'./**/*.{ts,tsx,js,jsx}': ['eslint --fix --max-warnings=0', 'prettier --write'],
|
||||
'./**/*.css': ['prettier --write', 'stylelint'],
|
||||
'./templates/**.html': ['prettier --write', 'stylelint'],
|
||||
"./**/*.{ts,tsx,js,jsx}": [
|
||||
"cd apps/remark42 && pnpm lint-staged:lint:scripts",
|
||||
"cd apps/remark42 && pnpm lint-staged:format",
|
||||
],
|
||||
"./**/*.css": [
|
||||
"cd apps/remark42 && pnpm lint-staged:lint:styles",
|
||||
"cd apps/remark42 && pnpm lint-staged:format",
|
||||
],
|
||||
"./templates/**.html": [
|
||||
"cd apps/remark42 && pnpm lint-staged:lint:styles",
|
||||
"cd apps/remark42 && pnpm lint-staged:format",
|
||||
],
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 510 B |
|
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
|
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 240 B |
|
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 393 B |
|
Before Width: | Height: | Size: 531 B After Width: | Height: | Size: 531 B |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 388 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |