diff --git a/.env.example b/.env.example index d5add05..11996ca 100644 --- a/.env.example +++ b/.env.example @@ -13,3 +13,5 @@ DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoide_data APP_VERSION=latest PORT=3000 HOSTNAME=0.0.0.0 + +PUBLIC_LANDING_INFO=true diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index be6c31f..f6871ef 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -60,6 +60,8 @@ jobs: with: context: . file: ./Dockerfile + build-args: | + PUBLIC_LANDING_INFO=${{ vars.PUBLIC_LANDING_INFO }} push: true platforms: linux/amd64,linux/arm64 cache-from: type=gha diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3ccaf3..3eba1a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,8 @@ jobs: - name: Build application run: npm run build + env: + PUBLIC_LANDING_INFO: ${{ vars.PUBLIC_LANDING_INFO }} - name: Test build output run: | diff --git a/Dockerfile b/Dockerfile index a44214f..6b4e63c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,26 +2,28 @@ FROM node:20-alpine AS builder WORKDIR /app COPY package*.json . -RUN npm ci +RUN npm ci --omit=dev + +ARG PUBLIC_LANDING_INFO +ENV PUBLIC_LANDING_INFO=$PUBLIC_LANDING_INFO + COPY . . RUN npm run build RUN npm prune --production FROM node:20-alpine - WORKDIR /app COPY --from=builder /app/build build/ COPY --from=builder /app/node_modules node_modules/ COPY package.json . -EXPOSE 3000 - ENV PORT 3000 ENV HOSTNAME "0.0.0.0" HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/healthz || exit 1 +EXPOSE 3000 CMD [ "node", "build" ] diff --git a/README.md b/README.md index 914e3c4..82f90ec 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,18 @@ Your app will be available at `http://localhost:5173`. You can use the Makefile Use the `database/seed.sql` if you want to populate your database with dummy data. -### i18n +### Options + +#### 1. Landing page option + +Supports a conditional landing page display based on the `PUBLIC_LANDING_INFO` environment variable. If you don't want to show your users the cactoide landing page, just use the `PUBLIC_LANDING_INFO=false` variable. This will automatically remove the landing home page and redirect users to the `/discover` page. + +This is useful for: + +- Creating a minimal discovery-focused experience +- Customizing the user journey based on deployment environment + +#### 2. i18n There is no proper i18n implemented, we have an `/i18n` folder with specific languages. To use an existing translation, just rename the language code JSON file to `messages.json` and you are ready to go. If you would like to add a new translation (which is really appreciated), just create a new `.json` file and add the translations from the `messages.json`. diff --git a/package.json b/package.json index 6f29528..fc34407 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cactoide", "private": true, - "version": "0.0.3", + "version": "0.1.1", "type": "module", "scripts": { "dev": "vite dev", diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte index 49d956c..e056062 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Navbar.svelte @@ -2,6 +2,7 @@ import { page } from '$app/stores'; import { goto } from '$app/navigation'; import { t } from '$lib/i18n/i18n.js'; + import { PUBLIC_LANDING_INFO } from '$env/static/public'; // Check if current page is active const isActive = (path: string): boolean => { @@ -24,12 +25,14 @@
- + {#if PUBLIC_LANDING_INFO !== 'false'} + + {/if}