From c8937659733352c73baaf2e46f6462a02e49927a Mon Sep 17 00:00:00 2001 From: Buddy Williams Date: Mon, 19 Apr 2021 10:12:02 -0400 Subject: [PATCH] Docker support on the Apple M1 chip / arm64 (#4024) * First pass at docker support on the Apple M1 chip * Added version to libpq-dev so that it passes linter checks; Removed comments --- bin/docker-backend | 7 +++++++ dev.Dockerfile | 3 ++- docker-compose.dev.yml | 21 +++++++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100755 bin/docker-backend diff --git a/bin/docker-backend b/bin/docker-backend new file mode 100755 index 00000000000..83c87d3d4ae --- /dev/null +++ b/bin/docker-backend @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +python manage.py migrate + +python manage.py runserver 0.0.0.0:8000 diff --git a/dev.Dockerfile b/dev.Dockerfile index 124871e31c1..3a1c5acf421 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -11,7 +11,7 @@ WORKDIR /code/ SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN apt-get update \ - && apt-get install -y --no-install-recommends 'curl=7.*' 'git=1:2.*' 'build-essential=12.6' \ + && apt-get install -y --no-install-recommends 'curl=7.*' 'git=1:2.*' 'build-essential=12.6' 'libpq-dev=11.*' \ && curl -sL https://deb.nodesource.com/setup_14.x | bash - \ && curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ @@ -23,6 +23,7 @@ RUN apt-get update \ && yarn --frozen-lockfile COPY requirements.txt . + RUN pip install -r requirements.txt --no-cache-dir COPY requirements-dev.txt . diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index dd346167b42..6248829140e 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -15,11 +15,11 @@ services: container_name: posthog_redis ports: - '6379:6379' - worker: &worker + backend: &backend build: context: . dockerfile: dev.Dockerfile - command: ./bin/docker-worker + command: ./bin/docker-backend volumes: - .:/code environment: @@ -36,9 +36,18 @@ services: links: - db:db - redis:redis - web: - <<: *worker - command: ./bin/docker-dev-web ports: - '8000:8000' - - '8234:8234' + #frontend: + #<<: *backend + #command: ./bin/docker-frontend + #ports: + #- '8234:8234' + worker: + <<: *backend + command: ./bin/docker-worker + ports: [] + depends_on: + - db + - redis + - backend