-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract common stuff from the different Dockerfiles
All Dockerfiles share most of the steps, apart from a couple of steps at the end. As such, to cut build time, I extracted the common steps into a separate Docker imaeg that all other images build on top of it.
- Loading branch information
Showing
13 changed files
with
301 additions
and
711 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
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,60 @@ | ||
FROM amazon-mwaa/airflow:2.8.0-base | ||
|
||
{% if bootstrapping_scripts_dev %} | ||
|
||
# Copy bootstrapping files. | ||
COPY ./bootstrap-dev /bootstrap-dev | ||
RUN chmod -R +x /bootstrap-dev | ||
|
||
{# | ||
Those steps are only exectued for development images. Those are images that | ||
contain additional packages that help with debugging, e.g. editors, etc., but | ||
are not supposed to be in production. | ||
#} | ||
|
||
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
# BEGINNING marker for dev bootstrapping steps. | ||
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
|
||
{% for filepath in bootstrapping_scripts_dev %} | ||
RUN {{ filepath }} | ||
{% endfor %} | ||
|
||
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | ||
# END marker for dev bootstrapping steps. | ||
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | ||
|
||
# remove bootstrapping files. | ||
RUN rm -rf /bootstrap-dev | ||
|
||
{% endif %} | ||
|
||
{% if build_type == 'standard' %} | ||
{# This is the standard build type. it is what customer uses.#} | ||
USER airflow | ||
|
||
ENTRYPOINT ["python3", "-m", "mwaa.entrypoint"] | ||
|
||
CMD shell | ||
{% elif build_type == 'explorer' %} | ||
{# | ||
The 'explorer' build type is almost identical to the 'standard' build type but | ||
it doesn't include the entrypoint. This is useful for debugging purposes to run | ||
the image and look around its content without starting airflow, which might | ||
require further setup. | ||
#} | ||
USER airflow | ||
|
||
ENTRYPOINT ["/bin/bash"] | ||
{% elif build_type == 'explorer-privileged' %} | ||
{# | ||
This is similar to the 'explorer' build type, but additionally uses the root | ||
user, giving the user of this Docker image elevated permissions. The user can, | ||
thus, install packages, remove packages, or anything else. | ||
#} | ||
USER root | ||
|
||
ENTRYPOINT ["/bin/bash"] | ||
{% else %} | ||
{{ raise("Invalid build type.") }} | ||
{% endif %} |
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
Oops, something went wrong.