Skip to content

Commit

Permalink
Fix docker build and cloud build config (#1175)
Browse files Browse the repository at this point in the history
* Remove redundant steps from docker build

* Fix cloud build config
  • Loading branch information
vish-cs authored Jan 9, 2025
1 parent fb70036 commit 2966dcf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
14 changes: 4 additions & 10 deletions import-automation/executor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ ENV JAVA_HOME=/usr/local/openjdk-17
COPY --from=openjdk:17-slim $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"

WORKDIR /workspace

ADD requirements.txt /workspace/requirements.txt
RUN pip install -r /workspace/requirements.txt

RUN git clone https://github.com/datacommonsorg/data.git
RUN wget https://github.com/datacommonsorg/import/releases/download/0.1-alpha.1k/datacommons-import-tool-0.1-alpha.1-jar-with-dependencies.jar
COPY app/. /workspace/app/
COPY main.py /workspace/

ENTRYPOINT ["python","./main.py"]
WORKDIR /data/import-automation/executor
RUN wget https://storage.googleapis.com/datacommons_public/import_tools/datacommons-import-tool-0.1-alpha.1-jar-with-dependencies.jar
RUN pip install -r requirements.txt
ENTRYPOINT ["python", "main.py"]
2 changes: 1 addition & 1 deletion import-automation/executor/app/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ExecutorConfig:
# ID of the location where Cloud Scheduler is hosted.
scheduler_location: str = 'us-central1'
# Location of the local git data repo.
local_repo_dir: str = '/workspace/data'
local_repo_dir: str = '/data'
# Maximum time a user script can run for in seconds.
user_script_timeout: float = 3600
# Arguments for the user script
Expand Down
14 changes: 2 additions & 12 deletions import-automation/executor/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
# Builds the docker image of import executor, pushes it to artifact registry,
# and creates a cloud run job using this images.
# Builds the docker image of import executor and pushes it to artifact registry.
#
# Run it using:
# gcloud builds submit --config=cloudbuild.yaml --substitutions=_DOCKER_IMAGE="us-docker.pkg.dev/datcom-ci/gcr.io/dc-import-executor:latest" .

steps:
# Install dependencies
- name: python
entrypoint: pip
args: ["install", "-r", "requirements.txt", "--user"]

# Docker Build
- name: 'gcr.io/cloud-builders/docker'
dir: 'import-automation/executor'
args: ['build', '-t', '${_DOCKER_IMAGE}', '.']

# Docker push to Google Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', '${_DOCKER_IMAGE}']

# Deploy to Cloud Run
#- name: google/cloud-sdk
# args: ['gcloud', 'run', 'jobs', 'deploy', '${_JOB_NAME}',
# '--image=${_DOCKER_IMAGE}', '--region', '${_REGION}']

# Store images in Google Artifact Registry
images:
- ${_DOCKER_IMAGE}

0 comments on commit 2966dcf

Please sign in to comment.