-
Notifications
You must be signed in to change notification settings - Fork 3
MapSwipe Revamp #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MapSwipe Revamp #76
Changes from all commits
85a4768
2babb09
2f58bf5
3b0c565
4538d32
2cab128
3aedc67
9a6add4
a9dcecb
5601898
1ace78c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules | ||
| dist | ||
| .git | ||
| .vscode |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Publish web app serve | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - develop | ||
| - project/* | ||
|
|
||
| permissions: | ||
| packages: write | ||
|
|
||
| jobs: | ||
| publish_image: | ||
| name: Publish Docker Image | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Publish web-app-serve | ||
| uses: toggle-corp/[email protected] | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # -------------------------- Dev --------------------------------------- | ||
|
|
||
| FROM node:22-bullseye AS dev | ||
|
|
||
| RUN apt-get update -y \ | ||
| && apt-get install -y --no-install-recommends git \ | ||
| && rm -rf /var/lib/apt/lists/* \ | ||
| && npm install -g [email protected] --force \ | ||
| && git config --global --add safe.directory /code | ||
|
|
||
| WORKDIR /code | ||
|
|
||
| # Build stage for web app | ||
| FROM dev AS web-app-serve-build | ||
|
|
||
| COPY ./package.json ./yarn.lock /code/ | ||
|
|
||
| RUN yarn install | ||
| COPY . /code/ | ||
|
|
||
| ENV VITE_FIREBASE_API_KEY=ExampleF1rebaseAP1k3y | ||
|
Check warning on line 21 in Dockerfile
|
||
| ENV VITE_FIREBASE_AUTH_DOMAIN=example-key.firebaseapp.com | ||
|
Check warning on line 22 in Dockerfile
|
||
| ENV VITE_FIREBASE_DATABASE_URL=https://example-database.firebaseio.com | ||
| ENV VITE_FIREBASE_PROJECT_ID=example | ||
| ENV VITE_FIREBASE_STORAGE_BUCKET=example.appspot.com | ||
| ENV VITE_FIREBASE_MESSAGING_SENDER_ID=123123456123 | ||
| ENV VITE_FIREBASE_APP_ID=1:23456789:web:1abc234def567 | ||
| ENV VITE_COMMUNITY_DASHBOARD_URL=https://mapswipe.org | ||
|
|
||
| ENV VITE_FIREBASE_MEASUREMENT_ID= | ||
| ENV VITE_MAPILLARY_API_KEY= | ||
|
Check warning on line 31 in Dockerfile
|
||
| ENV VITE_BASE_URL=https://mapswipe.org/privacy | ||
| ENV VITE_PRIVACY_POLICY_URL=https://mapswipe.org/privacy/ | ||
| ENV VITE_IMPRINT_URL=https://mapswipe.org/privacy/ | ||
| ENV VITE_APP_LOGO=./img/mapswipe-white.svg | ||
| ENV VITE_PROJECTS_FALLBACK_IMAGE=./img/map-pin-600x400.jpg | ||
| ENV VITE_ALLOW_UNVERIFIED_USERS=true | ||
|
|
||
| ENV VITE_DEFAULT_LOCALE=en | ||
| ENV VITE_FALLBACK_LOCALE=en | ||
| ENV VITE_SUPPORTED_LOCALES=en,de,fr | ||
|
|
||
| ENV VITE_THEME_LIGHT_PRIMARY=#060E2F | ||
| ENV VITE_THEME_LIGHT_SECONDARY=#0D1949 | ||
| ENV VITE_THEME_LIGHT_TERTIARY=#EEF2FB | ||
| ENV VITE_THEME_LIGHT_ACCENT=#589AE3 | ||
| ENV VITE_THEME_LIGHT_ERROR=#C62828 | ||
| ENV VITE_THEME_LIGHT_WARNING=#8E0000 | ||
| ENV VITE_THEME_LIGHT_INFO=#2196f3 | ||
| ENV VITE_THEME_LIGHT_SUCCESS=#4caf50 | ||
| ENV VITE_THEME_LIGHT_NEUTRAL=#272727 | ||
|
|
||
| ENV VITE_APP_NAME=MapSwipe | ||
| ENV VITE_APP_WEBSITE_URL=https://mapswipe.org | ||
| ENV VITE_APP_ATTRIBUTION_TITLE=MapSwipe | ||
| ENV VITE_APP_ATTRIBUTION_URL=https://mapswipe.org/privacy/ | ||
|
|
||
| RUN WEB_APP_SERVE_ENABLED=true yarn build-only --outDir=/code/build | ||
|
|
||
| FROM ghcr.io/toggle-corp/web-app-serve:v0.1.2 AS web-app-serve | ||
|
|
||
| LABEL org.opencontainers.image.source="github.com/mapswipe/mapswipe-web" | ||
| LABEL org.opencontainers.image.authors="[email protected]" | ||
|
|
||
| ENV APPLY_CONFIG__SOURCE_DIRECTORY=/code/build/ | ||
|
|
||
| COPY ./web-app-serve/web-app-apply-config.sh /code/ | ||
| ENV APPLY_CONFIG__APPLY_CONFIG_PATH=/code/web-app-apply-config.sh | ||
|
|
||
| COPY --from=web-app-serve-build /code/build "$APPLY_CONFIG__SOURCE_DIRECTORY" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { | ||
| defineConfig, | ||
| overrideDefineForWebAppServe, | ||
| Schema, | ||
| } from '@togglecorp/vite-plugin-validate-env'; | ||
|
|
||
| const webAppServeEnabled = process.env.WEB_APP_SERVE_ENABLED?.toLowerCase() === 'true'; | ||
| if (webAppServeEnabled) { | ||
| // eslint-disable-next-line no-console | ||
| console.warn('Building application for web-app-serve'); | ||
| } | ||
| const overrideDefine = webAppServeEnabled | ||
| ? overrideDefineForWebAppServe | ||
| : undefined; | ||
|
|
||
| export default defineConfig({ | ||
| overrideDefine, | ||
| validator: 'builtin', | ||
| schema: { | ||
| VITE_FIREBASE_API_KEY: Schema.string.optional(), | ||
| VITE_FIREBASE_AUTH_DOMAIN: Schema.string.optional(), | ||
| VITE_FIREBASE_DATABASE_URL: Schema.string({ format: 'url', protocol: true, tld: false }), | ||
| VITE_FIREBASE_PROJECT_ID: Schema.string.optional(), | ||
| VITE_FIREBASE_STORAGE_BUCKET: Schema.string.optional(), | ||
| VITE_FIREBASE_MESSAGING_SENDER_ID: Schema.string.optional(), | ||
| VITE_FIREBASE_APP_ID: Schema.string.optional(), | ||
| VITE_FIREBASE_MEASUREMENT_ID: Schema.string.optional(), | ||
| VITE_BASE_URL: Schema.string.optional({ format: 'url', protocol: true, tld: false }), | ||
| VITE_PRIVACY_POLICY_URL: Schema.string({ format: 'url', protocol: true, tld: false }), | ||
| VITE_IMPRINT_URL: Schema.string.optional({ format: 'url', protocol: true, tld: false }), | ||
| VITE_APP_NAME: Schema.string.optional(), | ||
| VITE_APP_ATTRIBUTION_TITLE: Schema.string.optional(), | ||
| VITE_APP_ATTRIBUTION_URL: Schema.string.optional({ format: 'url', protocol: true, tld: false }), | ||
| VITE_APP_WEBSITE_URL: Schema.string({ format: 'url', protocol: true, tld: false }), | ||
| VITE_APP_LOGO: Schema.string.optional(), | ||
| VITE_PROJECTS_FALLBACK_IMAGE: Schema.string.optional(), | ||
| VITE_ALLOW_UNVERIFIED_USERS: Schema.boolean(), | ||
|
|
||
| VITE_DEFAULT_LOCALE: Schema.string.optional(), | ||
| VITE_FALLBACK_LOCALE: Schema.string.optional(), | ||
| VITE_SUPPORTED_LOCALES: Schema.string.optional(), | ||
|
|
||
| VITE_THEME_LIGHT_PRIMARY: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_SECONDARY: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_TERTIARY: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_ACCENT: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_ERROR: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_WARNING: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_INFO: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_SUCCESS: Schema.string.optional(), | ||
| VITE_THEME_LIGHT_NEUTRAL: Schema.string.optional(), | ||
|
|
||
| VITE_COMMUNITY_DASHBOARD_URL: Schema.string({ format: 'url', protocol: true, tld: false }), | ||
|
|
||
| VITE_MAPILLARY_API_KEY: Schema.string.optional(), | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for "hard-coding" the env variables in the Dockerfile instead of grabbing them from the .env file?