Skip to content
Snippets Groups Projects
Dockerfile 1.46 KiB
Newer Older
Xiao Gui's avatar
Xiao Gui committed
FROM node:16 as builder
Xiao Gui's avatar
Xiao Gui committed

ARG BACKEND_URL
ENV BACKEND_URL=${BACKEND_URL}

ARG SIIBRA_API_ENDPOINTS
ENV SIIBRA_API_ENDPOINTS=${SIIBRA_API_ENDPOINTS:-https://siibra-api-stable.apps.hbp.eu/v3_0,https://siibra-api-prod.apps.tc.humanbrainproject.eu/v3_0}
Xiao Gui's avatar
Xiao Gui committed
ARG STRICT_LOCAL
ENV STRICT_LOCAL=${STRICT_LOCAL:-false}

ARG KIOSK_MODE
ENV KIOSK_MODE=${KIOSK_MODE:-false}
Xiao Gui's avatar
Xiao Gui committed
ARG MATOMO_URL
Xiao Gui's avatar
Xiao Gui committed
ENV MATOMO_URL=${MATOMO_URL}
Xiao Gui's avatar
Xiao Gui committed

ARG MATOMO_ID
ENV MATOMO_ID=${MATOMO_ID}

Xiao Gui's avatar
Xiao Gui committed
ARG EXPERIMENTAL_FEATURE_FLAG
ENV EXPERIMENTAL_FEATURE_FLAG=${EXPERIMENTAL_FEATURE_FLAG:-false}

ARG ENABLE_LEAP_MOTION
ENV ENABLE_LEAP_MOTION=${ENABLE_LEAP_MOTION:-false}

Xiao Gui's avatar
Xiao Gui committed
# mkdir, and copy package.json and package-lock.json and npm i
# to effectively use the caching layer
Xiao Gui's avatar
Xiao Gui committed

Xiao Gui's avatar
Xiao Gui committed
RUN mkdir /iv
Xiao Gui's avatar
Xiao Gui committed
WORKDIR /iv
Xiao Gui's avatar
Xiao Gui committed
COPY ./package.json /iv/
COPY ./package-lock.json /iv/
RUN npm i

COPY . /iv/
Xiao Gui's avatar
Xiao Gui committed

Xiao Gui's avatar
Xiao Gui committed
# angular 12 echo the env var into src/environments/environment.prod.ts
RUN node ./src/environments/parseEnv.js

Xiao Gui's avatar
Xiao Gui committed
RUN npm run build
Xiao Gui's avatar
Xiao Gui committed
RUN node third_party/matomo/processMatomo.js
FROM python:3.10-alpine

RUN adduser --disabled-password nonroot
Xiao Gui's avatar
Xiao Gui committed
RUN mkdir /common
COPY --from=builder /iv/common /common

RUN mkdir /iv-app
WORKDIR /iv-app

# Copy the fastapi server
COPY --from=builder /iv/backend .
RUN pip install -r requirements.txt
COPY --from=builder /iv/dist/aot /iv/backend/public
Xiao Gui's avatar
Xiao Gui committed

ENV PATH_TO_PUBLIC=/iv/backend/public
RUN chown -R nonroot:nonroot /iv-app
USER nonroot
Xiao Gui's avatar
Xiao Gui committed

Xiao Gui's avatar
Xiao Gui committed
EXPOSE 8080
ENTRYPOINT uvicorn app.app:app --host 0.0.0.0 --port 8080