You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2024/03/08 01:59:26 UTC

(superset) branch docker-compose created (now 39a2b21b5b)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a change to branch docker-compose
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 39a2b21b5b feat: docker-compose to work off repo Dockerfile

This branch includes the following new commits:

     new 39a2b21b5b feat: docker-compose to work off repo Dockerfile

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: feat: docker-compose to work off repo Dockerfile

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch docker-compose
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 39a2b21b5b4f992e8a01d6a63752601d93fc2224
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Feb 26 17:37:57 2024 -0800

    feat: docker-compose to work off repo Dockerfile
    
    Currently our docker-compose setup pulls images that have been built
    recently on the `master` branch. While this works in most cases, it's
    non-deterministic on not guaranteed to always work. For example if I
    merge a PR to master that removes a certain python library for instance,
    people in branches out there doing development that still have that
    dependencies are not going to work.
    
    In this PR, I change the docker-compose setup(s) to:
    - reference the local Dockerfile
    - point to the right cache location (apache/superset-cache:....)
    - make that DRY since it's repeated many times across the docker-compose
      files
    - touch up both docker-compose.yml and docker-compose-non-dev.yml with
      the same approach
    
    As far as testing goes, I made sure this builds and that the resulting
    setup is functional. I was also very fast in my experience, the cache
    was clearly leveraged here.
---
 docker-compose-non-dev.yml | 19 ++++++++++++++-----
 docker-compose.yml         | 22 ++++++++++++++++------
 2 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/docker-compose-non-dev.yml b/docker-compose-non-dev.yml
index 34aec9bbb7..d5c142926a 100644
--- a/docker-compose-non-dev.yml
+++ b/docker-compose-non-dev.yml
@@ -14,7 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-x-superset-image: &superset-image apachesuperset.docker.scarf.sh/apache/superset:${TAG:-latest}
 x-superset-depends-on: &superset-depends-on
   - db
   - redis
@@ -23,6 +22,12 @@ x-superset-volumes:
   - ./docker:/app/docker
   - superset_home:/app/superset_home
 
+x-common-build: &common-build
+  context: .
+  target: dev
+  cache_from:
+    - apache/superset-cache:3.9-slim-bookworm
+
 version: "3.7"
 services:
   redis:
@@ -43,7 +48,8 @@ services:
 
   superset:
     env_file: docker/.env-non-dev
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_app
     command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"]
     user: "root"
@@ -54,8 +60,9 @@ services:
     volumes: *superset-volumes
 
   superset-init:
-    image: *superset-image
     container_name: superset_init
+    build:
+      <<: *common-build
     command: ["/app/docker/docker-init.sh"]
     env_file: docker/.env-non-dev
     depends_on: *superset-depends-on
@@ -65,7 +72,8 @@ services:
       disable: true
 
   superset-worker:
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_worker
     command: ["/app/docker/docker-bootstrap.sh", "worker"]
     env_file: docker/.env-non-dev
@@ -81,7 +89,8 @@ services:
         ]
 
   superset-worker-beat:
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_worker_beat
     command: ["/app/docker/docker-bootstrap.sh", "beat"]
     env_file: docker/.env-non-dev
diff --git a/docker-compose.yml b/docker-compose.yml
index aba88707ca..0c2d53c775 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -14,7 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-x-superset-image: &superset-image apachesuperset.docker.scarf.sh/apache/superset:${TAG:-master-dev}
 x-superset-user: &superset-user root
 x-superset-depends-on: &superset-depends-on
   - db
@@ -27,6 +26,12 @@ x-superset-volumes: &superset-volumes
   - superset_home:/app/superset_home
   - ./tests:/app/tests
 
+x-common-build: &common-build
+  context: .
+  target: dev
+  cache_from:
+    - apache/superset-cache:3.9-slim-bookworm
+
 version: "3.7"
 services:
   nginx:
@@ -61,7 +66,8 @@ services:
 
   superset:
     env_file: docker/.env
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_app
     command: ["/app/docker/docker-bootstrap.sh", "app"]
     restart: unless-stopped
@@ -106,7 +112,8 @@ services:
       - REDIS_SSL=false
 
   superset-init:
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_init
     command: ["/app/docker/docker-init.sh"]
     env_file: docker/.env
@@ -129,7 +136,8 @@ services:
     volumes: *superset-volumes
 
   superset-worker:
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_worker
     command: ["/app/docker/docker-bootstrap.sh", "worker"]
     env_file: docker/.env
@@ -146,7 +154,8 @@ services:
     # mem_reservation: 128M
 
   superset-worker-beat:
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_worker_beat
     command: ["/app/docker/docker-bootstrap.sh", "beat"]
     env_file: docker/.env
@@ -158,7 +167,8 @@ services:
       disable: true
 
   superset-tests-worker:
-    image: *superset-image
+    build:
+      <<: *common-build
     container_name: superset_tests_worker
     command: ["/app/docker/docker-bootstrap.sh", "worker"]
     env_file: docker/.env