diff --git a/.eslintignore b/.eslintignore index 78bdfaee..b2365300 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,6 +4,7 @@ *.toml *.patch *.txt +Dockerfile public/ https-dev-config/localhost.crt https-dev-config/localhost.key diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..8e277a70 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,46 @@ +name: build & push docker container +on: + push: + branches: + - main + tags: + - '*' + pull_request: + branches: + - main +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Docker meta + id: metal + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/elk-zone/elk + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.metal.outputs.tags }} + labels: ${{ steps.metal.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 31e43a9d..a629b3c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,9 +93,17 @@ We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://i 1. Add a new file in [locales](./locales) folder with the language code as the filename. 2. Copy [en-US](./locales/en-US.json) and translate the strings. -3. Add the language to the `locales` array in [config/i18n.ts](./config/i18n.ts#L12), below `en` variants and `ar-EG`. -4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar-EG](./config/i18n.ts#L27) -5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar-EG](./config/i18n.ts#L27) +3. Add the language to the `locales` array in [config/i18n.ts](./config/i18n.ts#L12), below `en` and `ar`: + - If your language have multiple country variants, add the generic one for language only (only if there are a lot of common entries, you can always add it as a new one) + - Add all country variants in [country variants object](./config/i18n.ts#L97) + - Add all country variants files with empty `messages` object: `{}` + - Translate the strings in the generic language file + - Later, when anyone wants to add the corresponding translations for the country variant, you can override all entries in the corresponding file: check `en` (english variants), and override the entries in all country files, if you omit them, `i18n` module will use the language entry. You will need also copy from base file to the rest of country variants those messages not being shared (the Elk team is working on resolving this, assuming it can be resolved). + - If the generic language already exists: + - If the translation doesn't differ from the generic language, then add the corresponding translations in the corresponding file + - If the translation differs from the generic language, then add the corresponding translations in the corresponding file and remove it from the country variants entry +4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar](./config/i18n.ts#L22) +5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar](./config/i18n.ts#L23) Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization) for more info. diff --git a/Dockerfile b/Dockerfile index f45aaf26..389fef03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,16 @@ RUN pnpm build FROM base AS runner +ARG UID=911 +ARG GID=911 + +# Create a dedicated user and group +RUN set -eux; \ + addgroup -g $UID elk; \ + adduser -u $GID -D -G elk elk; + +USER elk + ENV NODE_ENV=production COPY --from=builder /elk/.output ./.output diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index e2779d21..8cb40f83 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -109,7 +109,7 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying)