adds option to build debug/dev frontend docker images

pull/101027/head
Brian Gann 5 months ago
parent f69e81facf
commit be54ebfe76
No known key found for this signature in database
GPG Key ID: E3B2E707BB551441
  1. 9
      Dockerfile
  2. 20
      Makefile

@ -14,6 +14,8 @@ ARG JS_SRC=js-builder
# Javascript build stage
FROM --platform=${JS_PLATFORM} ${JS_IMAGE} AS js-builder
ARG JS_NODE_ENV=production
ARG JS_YARN_BUILD_FLAG=build
ENV NODE_OPTIONS=--max_old_space_size=8000
@ -29,14 +31,17 @@ COPY e2e e2e
RUN apk add --no-cache make build-base python3
# Set the node env according to defaults or argument passed
#
ENV NODE_ENV=${JS_NODE_ENV}
RUN yarn install --immutable
COPY tsconfig.json eslint.config.js .editorconfig .browserslistrc .prettierrc.js ./
COPY scripts scripts
COPY emails emails
ENV NODE_ENV=production
RUN yarn build
# Set the build argument according to default or argument passed
RUN yarn ${JS_YARN_BUILD_FLAG}
# Golang build stage
FROM ${GO_IMAGE} AS go-builder

@ -342,6 +342,22 @@ shellcheck: $(SH_FILES) ## Run checks for shell scripts.
TAG_SUFFIX=$(if $(WIRE_TAGS)!=oss,-$(WIRE_TAGS))
PLATFORM=linux/amd64
# default to a production build for frontend
#
DOCKER_JS_NODE_ENV_FLAG = production
DOCKER_JS_YARN_BUILD_FLAG = build
#
# if go is in dev mode, also build node in dev mode
ifeq ($(GO_BUILD_DEV), dev)
DOCKER_JS_NODE_ENV_FLAG = dev
DOCKER_JS_YARN_BUILD_FLAG = dev
endif
# if NODE_ENV is set in the environment to dev, build frontend in dev mode, and allow go builds to use their default
ifeq (${NODE_ENV}, dev)
DOCKER_JS_NODE_ENV_FLAG = dev
DOCKER_JS_YARN_BUILD_FLAG = dev
endif
.PHONY: build-docker-full
build-docker-full: ## Build Docker image for development.
@echo "build docker container"
@ -349,6 +365,8 @@ build-docker-full: ## Build Docker image for development.
docker buildx build - \
--platform $(PLATFORM) \
--build-arg BINGO=false \
--build-arg NODE_ENV=$(DOCKER_JS_NODE_ENV_FLAG) \
--build-arg JS_YARN_BUILD_FLAG=$(DOCKER_JS_YARN_BUILD_FLAG) \
--build-arg GO_BUILD_TAGS=$(GO_BUILD_TAGS) \
--build-arg WIRE_TAGS=$(WIRE_TAGS) \
--build-arg COMMIT_SHA=$$(git rev-parse HEAD) \
@ -363,6 +381,8 @@ build-docker-full-ubuntu: ## Build Docker image based on Ubuntu for development.
docker buildx build - \
--platform $(PLATFORM) \
--build-arg BINGO=false \
--build-arg NODE_ENV=$(DOCKER_JS_NODE_ENV_FLAG) \
--build-arg JS_YARN_BUILD_FLAG=$(DOCKER_JS_YARN_BUILD_FLAG) \
--build-arg GO_BUILD_TAGS=$(GO_BUILD_TAGS) \
--build-arg WIRE_TAGS=$(WIRE_TAGS) \
--build-arg COMMIT_SHA=$$(git rev-parse HEAD) \

Loading…
Cancel
Save