mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
Make frontend build in Docker image optional (#4879)
* Add build arg to Dockerfile to control if we should build frontend assets * Move more env settings into the shared one. * Use build arg in docker-compose to skip frontend build. * CirlceCI: Skip building frontend assets in backend tests * Create dummy template files * Expand file names manually. * Add build arg to skip dev dependencies. * Update Dockerfile * Reverse logic of skip_dev_deps to what it should be.
This commit is contained in:
@@ -33,7 +33,7 @@ jobs:
|
||||
name: Build Docker Images
|
||||
command: |
|
||||
set -x
|
||||
docker-compose build --build-arg skip_ds_deps=true
|
||||
docker-compose build --build-arg skip_ds_deps=true --build-arg skip_frontend_build=true
|
||||
docker-compose up -d
|
||||
sleep 10
|
||||
- run:
|
||||
|
||||
@@ -6,11 +6,11 @@ docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||
|
||||
if [ $CIRCLE_BRANCH = master ] || [ $CIRCLE_BRANCH = preview-image ]
|
||||
then
|
||||
docker build -t redash/redash:preview -t redash/preview:$VERSION_TAG .
|
||||
docker build --build-arg skip_dev_deps=true -t redash/redash:preview -t redash/preview:$VERSION_TAG .
|
||||
docker push redash/redash:preview
|
||||
docker push redash/preview:$VERSION_TAG
|
||||
else
|
||||
docker build -t redash/redash:$VERSION_TAG .
|
||||
docker build --build-arg skip_dev_deps=true -t redash/redash:$VERSION_TAG .
|
||||
docker push redash/redash:$VERSION_TAG
|
||||
fi
|
||||
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -1,13 +1,16 @@
|
||||
FROM node:12 as frontend-builder
|
||||
|
||||
# Controls whether to build the frontend assets
|
||||
ARG skip_frontend_build
|
||||
|
||||
WORKDIR /frontend
|
||||
COPY package.json package-lock.json /frontend/
|
||||
COPY viz-lib /frontend/viz-lib
|
||||
RUN npm ci --unsafe-perm
|
||||
RUN if [ "x$skip_frontend_build" = "x" ] ; then npm ci --unsafe-perm; fi
|
||||
|
||||
COPY client /frontend/client
|
||||
COPY webpack.config.js /frontend/
|
||||
RUN npm run build
|
||||
RUN if [ "x$skip_frontend_build" = "x" ] ; then npm run build; else mkdir /frontend/client/dist && touch /frontend/client/dist/multi_org.html && touch /frontend/client/dist/index.html; fi
|
||||
|
||||
FROM python:3.7-slim
|
||||
|
||||
@@ -15,6 +18,8 @@ EXPOSE 5000
|
||||
|
||||
# Controls whether to install extra dependencies needed for all data sources.
|
||||
ARG skip_ds_deps
|
||||
# Controls whether to install dev dependencies.
|
||||
ARG skip_dev_deps
|
||||
|
||||
RUN useradd --create-home redash
|
||||
|
||||
@@ -67,7 +72,7 @@ ENV PIP_NO_CACHE_DIR=1
|
||||
# We first copy only the requirements file, to avoid rebuilding on every file
|
||||
# change.
|
||||
COPY requirements.txt requirements_bundles.txt requirements_dev.txt requirements_all_ds.txt ./
|
||||
RUN pip install -r requirements.txt -r requirements_dev.txt
|
||||
RUN if [ "x$skip_dev_deps" = "x" ] ; then pip install -r requirements.txt -r requirements_dev.txt; else pip install -r requirements.txt; fi
|
||||
RUN if [ "x$skip_ds_deps" = "x" ] ; then pip install -r requirements_all_ds.txt ; else echo "Skipping pip install -r requirements_all_ds.txt" ; fi
|
||||
|
||||
COPY . /app
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
# This configuration file is for the **development** setup.
|
||||
# For a production example please refer to getredash/setup repository on GitHub.
|
||||
version: '2'
|
||||
version: "2"
|
||||
x-redash-service: &redash-service
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
skip_frontend_build: "true"
|
||||
volumes:
|
||||
- .:/app
|
||||
x-redash-environment: &redash-environment
|
||||
REDASH_LOG_LEVEL: "INFO"
|
||||
REDASH_REDIS_URL: "redis://redis:6379/0"
|
||||
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
||||
REDASH_RATELIMIT_ENABLED: "false"
|
||||
REDASH_MAIL_DEFAULT_SENDER: "redash@example.com"
|
||||
REDASH_MAIL_SERVER: "email"
|
||||
services:
|
||||
@@ -22,9 +28,6 @@ services:
|
||||
environment:
|
||||
<<: *redash-environment
|
||||
PYTHONUNBUFFERED: 0
|
||||
REDASH_LOG_LEVEL: "INFO"
|
||||
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
||||
REDASH_RATELIMIT_ENABLED: "false"
|
||||
scheduler:
|
||||
<<: *redash-service
|
||||
command: dev_scheduler
|
||||
@@ -40,8 +43,6 @@ services:
|
||||
environment:
|
||||
<<: *redash-environment
|
||||
PYTHONUNBUFFERED: 0
|
||||
REDASH_LOG_LEVEL: "INFO"
|
||||
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
||||
redis:
|
||||
image: redis:3-alpine
|
||||
restart: unless-stopped
|
||||
|
||||
Reference in New Issue
Block a user