Skip to content

Commit

Permalink
Merge pull request #19 from dagster-io/benpankow/add-dockerfile-name-arg
Browse files Browse the repository at this point in the history
Add dockerfile name argument
  • Loading branch information
benpankow authored Jul 12, 2022
2 parents 46f3d72 + a5ab01c commit 4c89494
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/example-custom-dockerfile-name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Custom Dockerfile Name Example
on: push

jobs:
custom-dockerfile-name-example:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

# Configure access to ECR, for this example
# If you are using another registry, your steps may differ
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Cache Docker builds
uses: satackey/[email protected]
continue-on-error: true

- name: Run Dagster Cloud CI/CD action
# Here, use `uses: dagster-io/dagster-cloud-cicd-action/deploy@{version}`
# e.g. `uses: dagster-io/dagster-cloud-cicd-action/[email protected]`
uses: ./deploy
with:
location-file: ./example/minimal/locations.yaml
dagit-url: https://elementl.dogfood.dagster.cloud/dev
api-token: ${{ secrets.DAGSTER_AGENT_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Each location specified in the `locations.yaml` can have the following propertie
| `attribute` | (Optional) Specifies either a repository or a function that returns a repository. Can be used when the code contains multiple repositories but only one should be included. |
| `base_image` | If the build directory only contains a `requirements.txt` file and no `Dockerfile`, specifies the base Docker image to use to build the code location. |
| `target` | If providing a multistage `Dockerfile`, can be used to specify the [target stage](https://docs.docker.com/develop/develop-images/multistage-build/) to build. |
| `dockerfile` | Specifies the `Dockerfile` filename to use, if it has a custom name. |

## Developing the CI/CD Action

Expand Down
7 changes: 7 additions & 0 deletions dist/deploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21908,6 +21908,13 @@ async function buildDockerImages(
]);
}

if (location["dockerfile"]) {
dockerArguments = dockerArguments.concat([
"--file",
location["dockerfile"],
]);
}

await exec.exec("docker", dockerArguments, { cwd: buildPath });
});
});
Expand Down
2 changes: 1 addition & 1 deletion dist/deploy/index.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions dist/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21908,6 +21908,13 @@ async function buildDockerImages(
]);
}

if (location["dockerfile"]) {
dockerArguments = dockerArguments.concat([
"--file",
location["dockerfile"],
]);
}

await exec.exec("docker", dockerArguments, { cwd: buildPath });
});
});
Expand Down
2 changes: 1 addition & 1 deletion dist/preview/index.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions dist/update-only/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21908,6 +21908,13 @@ async function buildDockerImages(
]);
}

if (location["dockerfile"]) {
dockerArguments = dockerArguments.concat([
"--file",
location["dockerfile"],
]);
}

await exec.exec("docker", dockerArguments, { cwd: buildPath });
});
});
Expand Down
2 changes: 1 addition & 1 deletion dist/update-only/index.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions example/custom-dockerfile-name/CustomDockerfileName
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.8-slim

RUN pip install \
dagster \
dagster-cloud

WORKDIR /opt/dagster/app

COPY repo.py /opt/dagster/app
6 changes: 6 additions & 0 deletions example/custom-dockerfile-name/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Dockerfile Name Example

This example specifies custom Dockerfile filename to use as part of the image build process.

The GitHub actions workflow for this example can be found at
[`.github/workflows/example-custom-dockerfile-name.yml`](../../.github/workflows/example-custom-dockerfile-name.yml).
6 changes: 6 additions & 0 deletions example/custom-dockerfile-name/locations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
locations:
github_action_demo_custom_dockerfile_name:
build: .
dockerfile: CustomDockerfileName
registry: 764506304434.dkr.ecr.us-west-2.amazonaws.com/github-action-demo-minimal
python_file: repo.py
27 changes: 27 additions & 0 deletions example/custom-dockerfile-name/repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from dagster import RunRequest, pipeline, repository, schedule, sensor, solid


@solid()
def foo_solid(_):
pass


@solid()
def foo_solid_2(_):
pass


@pipeline
def foo_pipeline():
foo_solid()
foo_solid_2()


@pipeline
def other_foo_pipeline():
foo_solid()


@repository
def foo_repo():
return [foo_pipeline]
7 changes: 7 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ export async function buildDockerImages(
]);
}

if (location["dockerfile"]) {
dockerArguments = dockerArguments.concat([
"--file",
location["dockerfile"],
]);
}

await exec.exec("docker", dockerArguments, { cwd: buildPath });
});
});
Expand Down

0 comments on commit 4c89494

Please sign in to comment.