# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights to use, copy, modify, # merge, publish, distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # FROM python:3.9 # --------------------------------------------------------------------- # Install https://github.com/krallin/tini - a very small 'init' process # that helps processing signalls sent to the container properly. # --------------------------------------------------------------------- ARG TINI_VERSION=v0.19.0 RUN apt-get update && \ apt-get install -y curl jq && \ curl -Lo /usr/local/bin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-amd64 && \ chmod +x /usr/local/bin/tini # -------------------------------------------------------------------------- # Install and configure sshd. # https://docs.docker.com/engine/examples/running_ssh_service for reference. # -------------------------------------------------------------------------- RUN apt-get install -y openssh-server && \ # Creating /run/sshd instead of /var/run/sshd, because in the Debian # image /var/run is a symlink to /run. Creating /var/run/sshd directory # as proposed in the Docker documentation linked above just doesn't # work. mkdir -p /run/sshd EXPOSE 22 # ---------------------------------------- # Install GitLab CI required dependencies. # ---------------------------------------- ARG GITLAB_RUNNER_VERSION RUN curl -Lo /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/v${GITLAB_RUNNER_VERSION}/binaries/gitlab-runner-linux-amd64 && \ chmod +x /usr/local/bin/gitlab-runner # Test if the downloaded file was indeed a binary and not, for example, # an HTML page representing S3's internal server error message or something # like that. RUN apt-get install -y bash ca-certificates git git-lfs unzip && \ git lfs install --skip-repo RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o /tmp/awscliv2.zip && \ unzip /tmp/awscliv2.zip && \ ./aws/install && \ rm /tmp/awscliv2.zip # ------------------------------------------------------------------------------------- # Execute a startup script. # https://success.docker.com/article/use-a-script-to-initialize-stateful-container-data # for reference. # ------------------------------------------------------------------------------------- COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh ENTRYPOINT ["tini", "--", "/usr/local/bin/docker-entrypoint.sh"]