Skip to content

Commit

Permalink
[Centraldashboard v2] Env vars added to dockerfile (#3971)
Browse files Browse the repository at this point in the history
* Added production env var in dockerfile, and statement print in server init

* Kfam host is now fully qualified: profiles-kfam.kubeflow
  • Loading branch information
avdaredevil authored and k8s-ci-robot committed Aug 22, 2019
1 parent 840e24b commit b2c6cd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions components/centraldashboard/Dockerfile
Expand Up @@ -29,6 +29,7 @@ RUN npm rebuild && \
# Step 2: Packages assets for serving
FROM node:10-alpine AS serve

ENV NODE_ENV=production
WORKDIR /app
COPY --from=build /centraldashboard .

Expand Down
9 changes: 5 additions & 4 deletions components/centraldashboard/app/server.ts
Expand Up @@ -9,9 +9,10 @@ import {WorkgroupApi} from './api_workgroup';
import {KubernetesService} from './k8s_service';
import {getMetricsService} from './metrics_service_factory';

const defaultKfam = process.env.NODE_ENV !== 'production'
? 'localhost'
: 'profiles-kfam';
const isProduction = process.env.NODE_ENV === 'production';
const defaultKfam = isProduction
? 'profiles-kfam.kubeflow'
: 'localhost';

/* PROFILES_KFAM env vars will be set by Kubernetes if the Kfam service is
* available
Expand Down Expand Up @@ -52,7 +53,7 @@ async function main() {
});
app.listen(
port,
() => console.info(`Server listening on port http://localhost:${port}`));
() => console.info(`Server listening on port http://localhost:${port} (in ${isProduction?'production':'development'} mode)`));
}

// This will allow us to inspect uncaught exceptions around the app
Expand Down

0 comments on commit b2c6cd7

Please sign in to comment.