Skip to content

Commit

Permalink
✨ Feat: docker images for vitejs webapp
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachid F committed Apr 24, 2024
1 parent 7ed53c6 commit a960e2e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ apps/magic-link/dist
apps/client-ts/node_modules
apps/client-ts/.next

apps/client-vite/node_modules
apps/client-vite/dist

packages/api/node_modules
packages/api/dist
15 changes: 14 additions & 1 deletion apps/client-vite/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# run directly from the repo root directory
# docker build -f ./apps/magic-link/Dockerfile.dev .

# docker build -f ./apps/client-vite/Dockerfile.dev . \
# --build-arg VITE_STYTCH_PROJECT_ID=test \
# --build-arg VITE_STYTCH_SECRET=value2 \
# --build-arg VITE_STYTCH_PROJECT_ENV=value3 \
# --build-arg VITE_STYTCH_PUBLIC_TOKEN=value4 \
# --build-arg VITE_DISTRIBUTION=selfhosted \
# --build-arg VITE_BACKEND_DOMAIN=http://localhost:3000 \
# --build-arg VITE_MAGIC_LINK_DOMAIN=http://localhost:81 \
# --build-arg VITE_WEBAPP_DOMAIN=http://localhost


FROM node:20-alpine AS base
# =======================================================================
FROM base AS builder
Expand Down Expand Up @@ -31,8 +42,10 @@ ENV VITE_WEBAPP_DOMAIN="${VITE_WEBAPP_DOMAIN}"

RUN corepack enable


WORKDIR /app
RUN pnpm add -g turbo

#WORKDIR /app/apps/client-vite
# run the ML
CMD cd apps/client-vite && pnpm install && pnpm run dev --host
27 changes: 13 additions & 14 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,27 @@ services:
networks:
- backend

webapp-nextjs:
webapp-vite:
build:
dockerfile: ./apps/client-ts/Dockerfile.dev
dockerfile: ./apps/client-vite/Dockerfile.dev
context: ./
args:
VITE_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN}
VITE_FRONTEND_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
environment:
NEXT_PUBLIC_STYTCH_SECRET: ${NEXT_PUBLIC_STYTCH_SECRET}
NEXT_PUBLIC_STYTCH_PROJECT_ID: ${NEXT_PUBLIC_STYTCH_PROJECT_ID}
NEXT_PUBLIC_DISTRIBUTION: ${DISTRIBUTION}
NEXT_PUBLIC_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN}
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN: ${NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN}
NEXT_PUBLIC_STYTCH_PROJECT_ENV: ${NEXT_PUBLIC_STYTCH_PROJECT_ENV}
NEXT_PUBLIC_MAGIC_LINK_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
NEXT_PUBLIC_WEBAPP_DOMAIN: ${NEXT_PUBLIC_WEBAPP_DOMAIN}
NEXT_PUBLIC_STYTCH_SECRET: ${NEXT_PUBLIC_STYTCH_SECRET}
NEXT_PUBLIC_STYTCH_PROJECT_ID: ${NEXT_PUBLIC_STYTCH_PROJECT_ID}
NEXT_PUBLIC_DISTRIBUTION: ${DISTRIBUTION}
NEXT_PUBLIC_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN}
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN: ${NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN}
NEXT_PUBLIC_STYTCH_PROJECT_ENV: ${NEXT_PUBLIC_STYTCH_PROJECT_ENV}
NEXT_PUBLIC_MAGIC_LINK_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
NEXT_PUBLIC_WEBAPP_DOMAIN: ${NEXT_PUBLIC_WEBAPP_DOMAIN}
restart: unless-stopped
ports:
- 80:8090
- 80:5173
depends_on:
api:
condition: service_healthy
api:
condition: service_healthy
volumes:
- .:/app
networks:
Expand Down

0 comments on commit a960e2e

Please sign in to comment.