-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
56 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Docker | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
|
||
env: | ||
REGISTRY: docker.io | ||
IMAGE_NAME: example-compute-block | ||
|
||
jobs: | ||
build: | ||
name: Build docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Extract metadata for docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref, event=pr | ||
type=raw, value=latest, enable=${{ (github.ref == format('refs/heads/{0}', 'main')) }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
FROM python:3.12 | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Install Java for Spark | ||
RUN apt-get update && \ | ||
apt-get install -y default-jdk && \ | ||
apt-get clean | ||
|
||
COPY . ./app | ||
|
||
WORKDIR /app | ||
|
||
# Using this example-compute-block for testing, you have to copy your current version of scystream-sdk into this | ||
# directory. We copy it into the docker container, and install it there via the folder. | ||
RUN python3 -m venv .venv && \ | ||
.venv/bin/pip install --upgrade pip && \ | ||
.venv/bin/pip install ./scystream-sdk | ||
COPY requirements.txt /app | ||
|
||
RUN pip install --upgrade pip && pip install -r requirements.txt | ||
|
||
COPY . /app | ||
|
||
|
||
ENV VIRTUAL_ENV=/app/.venv | ||
ENV PATH="/app/.venv/bin:$PATH" | ||
# CMD sh -c "python -c 'import main; from scystream.sdk.scheduler import Scheduler; Scheduler.execute_function(\"test_file\")'" | ||
|
||
# Keep the container running. Just for testing, normally placeholder which will be overriden by DockerOperator | ||
CMD ["tail", "-f", "/dev/null"] | ||
# Cmd that will be overwritten by Airflow | ||
CMD ["sh", "-c","echo Container is ready for the Scheduler.exectue_function call."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scystream-sdk==1.0 |