diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8111c485..00000000 --- a/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -#### -# This Dockerfile is used to build the container for charon -# -# charon requires python 3 -# -# 0. Step into the project dir -# -# 1. Build the image -# docker/podman build -t charon:1.0.0 . -# -# 2. Run the container as daemon, mount the host ~/upload/ path to container /root/upload/ path, -# the uploading path is the dir location where you will upload the tarballs from -# add -e to set specific environment variables, such as: AWS_PROFILE, aws_endpoint_url, bucket -# docker/podman run -dit -v ~/upload/:/root/upload/ --name charon charon:1.0.0 -# -# 3. Execute the container -# docker/podman exec -it charon bash -# -# 4. Start using uploader -# charon upload/delete from /root/upload/... -### - -# parser directive, always points to the latest release of the version 1 syntax, -# automatically checks for updates before building, making sure using the most current version -# syntax=docker/dockerfile:1 -FROM python:3.8 - -# ensure the latest version of pip -RUN pip3 install --no-cache-dir --upgrade pip - -RUN adduser charon -USER charon -WORKDIR /home/charon - -# pip respects TMPDIR to set another enough disk space for pip packages installation -ENV TMPDIR="/home/charon/tmp" - -# install all required packages -COPY --chown=charon:charon requirements.txt ./ -RUN pip3 install --user --no-cache-dir -r requirements.txt - -# prepare configs for charon -ADD ./config/charon.conf /home/charon/.charon/charon.conf -ADD ./config/aws-credentials /home/charon/.aws/credentials - -# prepare templates for charon -ADD ./template/index.html.j2 /home/charon/.charon/template/index.html.j2 -ADD ./template/maven-metadata.xml.j2 /home/charon/.charon/template/maven-metadata.xml.j2 - -ENV PATH="/home/charon/.local/bin:${PATH}" -COPY --chown=charon:charon . . - -# install charon -RUN pip3 install --user --no-cache-dir . - -# this will be invoked when container runs, charon will directly setup -# from the container and keep running as long as the bash is active -CMD ["bash"] diff --git a/config/charon.yaml.sample b/config/charon.yaml.sample index 97c37d4a..b3e0fb71 100644 --- a/config/charon.yaml.sample +++ b/config/charon.yaml.sample @@ -1,3 +1,6 @@ +#aws_profile: ${profile} +#aws_cf_enable: True + ignore_patterns: - ".*^(redhat).*" - ".*snapshot.*" @@ -30,3 +33,5 @@ targets: - bucket: "stage-npm-npmjs" prefix: / registry: "npm.stage.registry.redhat.com" + +#manifest_bucket: manifest \ No newline at end of file diff --git a/image/Containerfile b/image/Containerfile new file mode 100644 index 00000000..34074ff2 --- /dev/null +++ b/image/Containerfile @@ -0,0 +1,60 @@ +#### +# This Containerfile is used to build the container for charon +# +# charon requires python 3 +# +# 0. Step into the project dir +# +# 1. Build the image +# docker/podman build -t charon:1.0.0 -f image/Containerfile . +# +# 2. Run the container as daemon, mount the host ~/upload/ path to container /root/upload/ path, +# the uploading path is the dir location where you will upload the tarballs from +# add -e to set specific environment variables, such as: AWS_PROFILE, aws_endpoint_url, bucket +# docker/podman run -dit -v ~/upload/:/home/charon/upload/ --name charon charon:1.0.0 +# +# 3. Execute the container +# docker/podman exec -it charon bash +# +# 4. Start using uploader +# charon upload/delete from /home/charon/upload/... +### +FROM registry.access.redhat.com/ubi8-minimal:latest + +LABEL description="Charon upload image" \ + summary="Charon upload image" \ + maintainer="RedHat SPMM Team " \ + vendor="Red Hat, Inc." \ + distribution-scope="public" \ + vcs-type="git" + +ARG USER=charon +ARG UID=10000 +ARG HOME_DIR=/home/${USER} + +WORKDIR ${HOME_DIR} + +USER root + +RUN microdnf install -y python3.9 jq shadow-utils \ + && microdnf clean all +RUN pip3 install --no-cache-dir --upgrade pip +RUN useradd -d ${HOME_DIR} -u ${UID} -g 0 -m -s /bin/bash ${USER} \ + && chown ${USER}:0 ${HOME_DIR} \ + && chmod -R g+rwx ${HOME_DIR} \ + && chmod g+rw /etc/passwd + +COPY ./charon ./charon +COPY ./requirements.txt ./setup.py ./ + +RUN pip3 install --no-cache-dir -r ./requirements.txt +RUN pip3 install --no-cache-dir . + +USER ${USER} + +ENV HOME=${HOME_DIR} \ + LANG=en_US.UTF-8 + +# this will be invoked when container runs, charon will directly setup +# from the container and keep running as long as the bash is active +CMD ["bash"]