Skip to content

Commit

Permalink
feat: add map with locations and deployment (#636)
Browse files Browse the repository at this point in the history
* feat: add map with locations and deployment

* add build scripts

* update output

* add secret
  • Loading branch information
gregkonush authored Dec 24, 2024
1 parent c03edff commit 394b918
Show file tree
Hide file tree
Showing 19 changed files with 877 additions and 22 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/docker-build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: Docker Build and Push
on:
push:
branches:
- "main"
- 'main'
paths:
- "apps/proompteng/**"
- 'apps/proompteng/**'
- 'apps/findbobastore/**'

jobs:
version:
Expand Down Expand Up @@ -41,3 +42,15 @@ jobs:
secrets:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}

build-findbobastore:
needs: version
uses: ./.github/workflows/docker-build-common.yaml
with:
image_name: findbobastore
dockerfile: ./apps/findbobastore/Dockerfile
context: .
new_tag: ${{ needs.version.outputs.new_tag }}
secrets:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
35 changes: 31 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: true

jobs:
main:
proompteng:
runs-on: arc-arm64
steps:
- uses: actions/checkout@v4
Expand All @@ -26,12 +26,39 @@ jobs:
cache: 'pnpm'

- run: pnpm install --frozen-lockfile

- uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/apps/proompteng/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
key: ${{ runner.os }}-nextjs-proompteng-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-proompteng-${{ hashFiles('**/pnpm-lock.yaml') }}-
- run: pnpm --filter proompteng build

findbobastore:
runs-on: arc-arm64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 22.12.0
cache: 'pnpm'

- run: pnpm install --frozen-lockfile

- uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/apps/findbobastore/.next/cache
key: ${{ runner.os }}-nextjs-findbobastore-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
${{ runner.os }}-nextjs-findbobastore-${{ hashFiles('**/pnpm-lock.yaml') }}-
- run: pnpm build
- run: pnpm --filter findbobastore build
39 changes: 39 additions & 0 deletions apps/findbobastore/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM node:lts-alpine AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
COPY apps/findbobastore/package.json ./apps/findbobastore/
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
RUN corepack enable
RUN pnpm install --frozen-lockfile

FROM node:lts-alpine AS builder
WORKDIR /app
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
RUN corepack enable
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/apps/findbobastore/node_modules ./apps/findbobastore/node_modules
COPY . .
RUN pnpm build:findbobastore

FROM node:lts-alpine AS runner
WORKDIR /app

ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1

RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs

COPY --from=builder --chown=nextjs:nodejs /app/apps/findbobastore/.next/standalone /app
COPY --from=builder --chown=nextjs:nodejs /app/apps/findbobastore/.next/static /app/apps/findbobastore/.next/static
COPY --from=builder --chown=nextjs:nodejs /app/apps/findbobastore/public /app/apps/findbobastore/public

USER nextjs

EXPOSE 3000

ENV PORT=3000
ENV HOSTNAME="0.0.0.0"

WORKDIR /app/apps/findbobastore
CMD ["node", "server.js"]
3 changes: 2 additions & 1 deletion apps/findbobastore/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
/* config options here */
output: 'standalone',
poweredByHeader: false,
}

export default nextConfig
14 changes: 9 additions & 5 deletions apps/findbobastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@
"lint": "next lint"
},
"dependencies": {
"clsx": "^2.1.1",
"framer-motion": "^11.15.0",
"mapbox-gl": "^3.9.1",
"next": "15.1.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"next": "15.1.2"
"tailwind-merge": "^2.5.5"
},
"devDependencies": {
"typescript": "^5",
"@eslint/eslintrc": "^3",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^9",
"eslint-config-next": "15.1.2",
"@eslint/eslintrc": "^3"
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}
4 changes: 2 additions & 2 deletions apps/findbobastore/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const geistMono = Geist_Mono({
})

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
title: 'Find Boba Store',
description: 'Find Boba Store',
}

export default function RootLayout({
Expand Down
11 changes: 8 additions & 3 deletions apps/findbobastore/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { MapContainer } from '@/components/map-container'

export default function Home() {
return (
<div className="flex flex-col items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<div className="text-4xl font-bold">Find Boba Store</div>
</div>
<main className="relative w-full h-screen">
<div className="absolute top-4 left-4 z-10 bg-slate-900/80 px-4 py-2 rounded-lg">
<h1 className="text-xl font-bold text-white">Find Boba Store</h1>
</div>
<MapContainer />
</main>
)
}
16 changes: 16 additions & 0 deletions apps/findbobastore/src/components/map-container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use client'

import dynamic from 'next/dynamic'

const MapView = dynamic(() => import('./map-view'), {
ssr: false,
loading: () => (
<div className="w-full h-screen flex items-center justify-center">
<div className="text-lg">Loading map...</div>
</div>
),
})

export function MapContainer() {
return <MapView />
}
Loading

0 comments on commit 394b918

Please sign in to comment.