Skip to content

Commit

Permalink
Makefile update
Browse files Browse the repository at this point in the history
  • Loading branch information
andreax79 committed Jun 30, 2023
1 parent ab58116 commit 2388551
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 17 deletions.
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ help:
@echo "- make coverage Run tests coverage"
@echo "- make lint Run lint"
@echo "- make codemirror Update CodeMirror"
@echo "- make webserver Start Airflow webserver"
@echo "- make scheduler Start Airflow scheduler"
@echo "- make npm-build Run npm build"
@echo "- make npm-watch Run npm build when files change"
@echo "Development image:"
@echo "- make dev-image Build dev image"
@echo "- make dev-shell Start a shell in the dev environment"
@echo "- make standalone Run an all-in-one copy of Airflow"
@echo "- make webserver Start a Airflow webserver instance"
@echo "- make scheduler Start a scheduler instance"

lint:
flake8 airflow_code_editor tests
Expand All @@ -22,14 +26,20 @@ tag:
@grep -q "## $$(cat airflow_code_editor/VERSION)" changelog.txt || (echo "Missing changelog !!! Update changelog.txt"; exit 1)
@git tag -a "v$$(cat airflow_code_editor/VERSION)" -m "version v$$(cat airflow_code_editor/VERSION)"

dev-image:
$(MAKE) -C docker dev-image

dev-shell:
$(MAKE) -C docker dev-shell

webserver:
@./scripts/airflow.sh webserver
$(MAKE) -C docker webserver

scheduler:
@./scripts/airflow.sh scheduler
$(MAKE) -C docker scheduler

standalone:
@./scripts/airflow.sh standalone
$(MAKE) -C docker standalone

build: clean
python3 setup.py bdist_wheel
Expand Down
49 changes: 37 additions & 12 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
IMAGE_NAME=airflow-code-editor
DEV_IMAGE_NAME=${IMAGE_NAME}-dev
OWNER=andreax79
AIRFLOW_VERSION=2.6.1
AIRFLOW_VERSION=2.6.2
AIRFLOW_PORT=8080
PLUGIN_VERSION=`cat ../airflow_code_editor/VERSION`
VERSION=${AIRFLOW_VERSION}-${PLUGIN_VERSION}

.PHONY: help build test format image push all

makeFileDir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

help:
@echo "Release:"
@echo "- make image Build docker image"
@echo "- make push Push docker image"
@echo "Development:"
@echo "Development image:"
@echo "- make dev-image Build dev image"
@echo "- make dev-shell Start a shell in the dev environment"
@echo "- make webserver Start Airflow webserver from dev image"
@echo "- make standalone Run an all-in-one copy of Airflow"
@echo "- make webserver Start a Airflow webserver instance"
@echo "- make scheduler Start a scheduler instance"


.DEFAULT_GOAL := help

Expand Down Expand Up @@ -75,28 +80,48 @@ dev-image:
@rm ./requirements.txt ./requirements-optional.txt

dags:
@git clone https://github.com/andreax79/airflow-maintenance-dags dags
@git clone https://github.com/andreax79/airflow-maintenance-dags ${makeFileDir}/dags

dev-shell:
@touch ${PWD}/.bash_history
dev-shell: dags
@touch ${makeFileDir}/.bash_history
@docker run --rm -it \
-h airflow \
-v ${PWD}/.bash_history:/home/airflow/.bash_history \
-v ${PWD}/dags:/opt/airflow/dags \
-v ${PWD}/../airflow_code_editor:/home/airflow/.local/lib/python3.7/site-packages/airflow_code_editor/ \
-v ${makeFileDir}/.bash_history:/home/airflow/.bash_history \
-v ${makeFileDir}/dags:/opt/airflow/dags \
-v ${makeFileDir}/../airflow_code_editor:/home/airflow/.local/lib/python3.7/site-packages/airflow_code_editor/ \
-p ${AIRFLOW_PORT}:${AIRFLOW_PORT} \
-e AIRFLOW_UID=$$(id -u) \
${DEV_IMAGE_NAME} \
bash -l

webserver:
webserver: dags
@docker run --rm -it \
-h airflow \
-v ${PWD}/../airflow_code_editor:/home/airflow/.local/lib/python3.7/site-packages/airflow_code_editor/ \
-v ${PWD}/dags:/opt/airflow/dags \
-v ${makeFileDir}/../airflow_code_editor:/home/airflow/.local/lib/python3.7/site-packages/airflow_code_editor/ \
-v ${makeFileDir}/dags:/opt/airflow/dags \
-p ${AIRFLOW_PORT}:${AIRFLOW_PORT} \
-e AIRFLOW_UID=$$(id -u) \
${DEV_IMAGE_NAME} \
airflow webserver

standalone: dags
@docker run --rm -it \
-h airflow \
-v ${makeFileDir}/../airflow_code_editor:/home/airflow/.local/lib/python3.7/site-packages/airflow_code_editor/ \
-v ${makeFileDir}/dags:/opt/airflow/dags \
-p ${AIRFLOW_PORT}:${AIRFLOW_PORT} \
-e AIRFLOW_UID=$$(id -u) \
${DEV_IMAGE_NAME} \
airflow standalone

scheduler: dags
@docker run --rm -it \
-h airflow \
-v ${makeFileDir}/../airflow_code_editor:/home/airflow/.local/lib/python3.7/site-packages/airflow_code_editor/ \
-v ${makeFileDir}/dags:/opt/airflow/dags \
-p ${AIRFLOW_PORT}:${AIRFLOW_PORT} \
-e AIRFLOW_UID=$$(id -u) \
${DEV_IMAGE_NAME} \
airflow scheduler

all: help

0 comments on commit 2388551

Please sign in to comment.