forked from martin-sicho/genui-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-main
43 lines (35 loc) · 1.48 KB
/
Dockerfile-main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
ARG GENUI_DOCKER_IMAGE_TAG=latest
ARG GENUI_DOCKER_IMAGE_PREFIX=sichom
FROM ${GENUI_DOCKER_IMAGE_PREFIX}/genui-base:${GENUI_DOCKER_IMAGE_TAG}
# setup arguments
ARG ROOT_DIR=/genui
ARG BACKEND_DIR=./src/genui
ARG FRONTEND_DIR=./src/genui-gui
# setup environment variables
ENV GENUI_BACKEND_DIR=${ROOT_DIR}/${BACKEND_DIR}
ENV GENUI_FRONTEND_DIR=${ROOT_DIR}/${FRONTEND_DIR}
ENV REACT_APP_GENUI_DEPLOY_VERSION=${GENUI_DOCKER_IMAGE_TAG}
ENV PUBLIC_URL=/app
# install nodejs
ENV NODE_VERSION=17.9.0
RUN wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh && chmod +x install.sh && ./install.sh
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
# install the frontend app dependencies
COPY ${FRONTEND_DIR}/package.json ${GENUI_FRONTEND_DIR}/package.json
COPY ${FRONTEND_DIR}/package-lock.json ${GENUI_FRONTEND_DIR}/package-lock.json
RUN npm --prefix ${GENUI_FRONTEND_DIR} install ${GENUI_FRONTEND_DIR}
# build the frontend
COPY ${FRONTEND_DIR} ${GENUI_FRONTEND_DIR}
RUN npm run-script build --prefix ${GENUI_FRONTEND_DIR}
# copy backend code
COPY ${BACKEND_DIR} ${GENUI_BACKEND_DIR}
# copy the entrypoint script
COPY ./entrypoint-main.sh ${ROOT_DIR}/entrypoint-main.sh
# set working directory to where the manage.py lives
WORKDIR ${GENUI_BACKEND_DIR}/src/