diff --git a/app/next-client-app/Dockerfile b/app/next-client-app/Dockerfile index b71eed915..f63c28e25 100644 --- a/app/next-client-app/Dockerfile +++ b/app/next-client-app/Dockerfile @@ -13,6 +13,13 @@ RUN \ else echo "Lockfile not found." && exit 1; \ fi +# Building code for dev. +FROM base AS dev + +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + # Rebuild the source code only when needed FROM base AS builder @@ -20,17 +27,12 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . -# Build the app -RUN \ - if [ -f package-lock.json ]; then npm run build; \ - else echo "Lockfile not found." && exit 1; \ - fi +RUN npm run build # Production image, copy all the files and run next FROM base AS runner WORKDIR /app -ENV NODE_ENV production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs @@ -48,10 +50,4 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs -EXPOSE 3000 - -ENV PORT=3000 - -# server.js is created by next build from the standalone output -# https://nextjs.org/docs/pages/api-reference/next-config-js/output -CMD HOSTNAME="0.0.0.0" node server.js +CMD ["node", "server.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8679f7277..9994b6c33 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,13 +14,22 @@ services: build: context: app/next-client-app dockerfile: Dockerfile + target: dev + command: npm run dev ports: - 3000:3000 environment: - BACKEND_URL=http://web:8000 - BACKEND_ORIGIN=localhost:8000 + - NEXTAUTH_URL=http://next-client:3000/ + - NEXTAUTH_SECRET=verycomplexsecretkey + - NEXTAUTH_BACKEND_URL=http://web:8000/api/ + - NODE_ENV=development + - WATCHPACK_POLLING=true volumes: - - ./app/next-client-app:/next-client-app + - ./app/next-client-app:/app + - /app/node_modules + - /app/.next omop-lite: image: ghcr.io/andyrae/omop-lite @@ -56,8 +65,10 @@ services: - AZURE_ACCOUNT_NAME=devstoreaccount1 - AZ_URL=http://workers:80 - AZ_RULES_NAME=RulesOrchestrator - - AZ_RULES_EXPORT_QUEUE=rules=exports-local + - AZ_RULES_KEY=rules_key + - AZ_RULES_EXPORT_QUEUE=rules-exports-local - STORAGE_CONN_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1; + - SIGNING_KEY=secret volumes: - ./app/api:/api depends_on: @@ -73,13 +84,13 @@ services: - 8080:80 - 7071:80 environment: + # Set Docker to look for secrets locally + - AzureWebJobsSecretStorageType=files - IsEncrypted=false - AzureWebJobsStorage=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1; - FUNCTIONS_WORKER_RUNTIME=python - STORAGE_CONN_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1; - APP_URL=http://web:8000/ - # The key below needed for authentication and can be obtained through localhost:8000/admin/ --> add tokens - - AZ_FUNCTION_KEY=2d374a1f460fc9627d69e99c6cbeabf3f759d517 # Four queues below need adding to Azure local storage - SCAN_REPORT_QUEUE_NAME=scanreports-local - UPLOAD_QUEUE_NAME=uploadreports-local @@ -89,9 +100,18 @@ services: - CHUNK_SIZE=6 # The address that can be used to reach the function app from outside - WEBSITE_HOSTNAME=localhost:7071 + # Database setup + - COCONNECT_DB_ENGINE=django.db.backends.postgresql + - COCONNECT_DB_HOST=db + - COCONNECT_DB_PORT=5432 + - COCONNECT_DB_NAME=postgres + - COCONNECT_DB_USER=postgres + - COCONNECT_DB_PASSWORD=postgres volumes: - ./app/workers:/home/site/wwwroot - ./app/shared:/shared + # Mount the local secret to Docker container + - ./app/workers/Secrets:/azure-functions-host/Secrets/ depends_on: - web - azurite