Skip to content

Commit

Permalink
Adding ability to push self hoisting staging docker compose serice
Browse files Browse the repository at this point in the history
  • Loading branch information
corps committed Sep 12, 2024
1 parent 374b782 commit 0ada06d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 351 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ NO_SENTRY_INTEGRATION=... # Set this to 1 in develop mode to ignore Local Sentry
NO_REAL_MODELS=... # Set this to 1 in development to ignore real models and use stubs

RPC_SHARED_SECRET="seers-also-very-long-value-haha" # Match with SEER_RPC_SHARED_SECRET=[""] in sentry.conf.py
SBX_PROJECT=eng-dev-sbx--XXX # If using push-image and https://github.com/getsentry/terraform-sandboxes.private
13 changes: 13 additions & 0 deletions Compose.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM docker:cli

ARG SBX_PROJECT
ENV SBX_PROJECT=${SBX_PROJECT}

RUN mkdir /app
WORKDIR /app

COPY .env /app/
COPY docker-compose.yml /app/
COPY docker-compose.staging.yml /app/

CMD ["/usr/local/bin/docker", "compose", "-f", "/app/docker-compose.yml", "-f", "docker-compose.staging.yml", "up"]
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 &
RUN ln -s /usr/bin/python /usr/local/bin/python && \
ln -s /usr/bin/python3 /usr/local/bin/python3

# Copy model files (assuming they are in the 'models' directory)
COPY models/ models/

# Copy setup files, requirements, and scripts
COPY setup.py requirements.txt celeryworker.sh celerybeat.sh gunicorn.sh ./

RUN chmod +x ./celeryworker.sh ./celerybeat.sh ./gunicorn.sh

# Install dependencies
COPY setup.py requirements.txt ./
RUN pip install --upgrade pip==24.0
RUN pip install -r requirements.txt --no-cache-dir

# Copy model files (assuming they are in the 'models' directory)
COPY models/ models/
# Copy scripts
COPY celeryworker.sh celerybeat.sh gunicorn.sh ./
RUN chmod +x ./celeryworker.sh ./celerybeat.sh ./gunicorn.sh

# Copy source code
COPY src/ src/
COPY pyproject.toml .
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,12 @@ gocd: ## Build GoCD pipelines
# Convert JSON to yaml
cd ./gocd/generated-pipelines && find . -type f \( -name '*.yaml' \) -print0 | xargs -n 1 -0 yq -p json -o yaml -i
.PHONY: gocd

push-staging:
# Ensure the google authentication helper is working. If this fails, https://cloud.google.com/artifact-registry/docs/docker/authentication#gcloud-helper
gcloud auth configure-docker us-west1-docker.pkg.dev > /dev/null
# Setup your SBX_PROJECT in .env from the sandbox project name
docker build . -t us-west1-docker.pkg.dev/$(SBX_PROJECT)/staging/seer
docker build . -f Compose.Dockerfile --build-arg SBX_PROJECT=$(SBX_PROJECT) -t us-west1-docker.pkg.dev/$(SBX_PROJECT)/staging/seer.compose
docker push us-west1-docker.pkg.dev/$(SBX_PROJECT)/staging/seer
docker push us-west1-docker.pkg.dev/$(SBX_PROJECT)/staging/seer.compose
Loading

0 comments on commit 0ada06d

Please sign in to comment.