Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Speed up build #2041

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,22 @@ RUN yum -y install epel-release &&\
yum -y install findutils &&\
yum clean all

RUN chgrp -R root ${ROOT_GROUP_DIRS} &&\
chmod -R g+rwx ${ROOT_GROUP_DIRS}

COPY . /tmp

WORKDIR /tmp
COPY requirements.txt /requirements.txt
RUN chgrp -R root ${ROOT_GROUP_DIRS} && \
chmod -R g+rwx ${ROOT_GROUP_DIRS} && \
pip3 install --no-cache-dir -r /requirements.txt

COPY nginx.conf /etc/nginx
EXPOSE 8000
CMD [ "/usr/sbin/nginx" ]

RUN git clone --no-checkout https://github.com/CSCfi/csc-user-guide git_folder && \
if [ -d ".git" ]; then rm -r .git; fi && \
mv git_folder/.git . && \
rm -r git_folder && \
git reset HEAD --hard && \
Comment on lines -25 to -29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this is still needed to generate the modification dates in the pages.

Screenshot from 2024-03-25 14-27-51

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which is not present in the build done by Rahti BC. Keep in mind that the preview and the production are very different processes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 the git log says that the page was modified March 7 2023.

The Last update seems to be the same on the feature branch as well as master:
https://csc-guide-preview.rahtiapp.fi/origin/testing-speedup/cloud/
https://docs.csc.fi/cloud/

There is of course something that I still might be missing.

I'm also wondering that IF it is still needed maybe it would be possible to use ADD --keep-git-dir=true instead of COPY . /tmp

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a Build config OpenShift clones the code automatically but removes the .git directory before starting to run Dockerfile. I can prepare a demo example later today/tomorrow.

git checkout -f $repo_branch
COPY . /tmp
WORKDIR /tmp

RUN pip3 install --no-cache-dir -r requirements.txt && \
bash scripts/generate_alpha.sh && \
RUN bash scripts/generate_alpha.sh && \
bash scripts/generate_by_system.sh && \
bash scripts/generate_new.sh && \
bash scripts/generate_glossary.sh && \
mkdocs build -d /usr/share/nginx/html

COPY nginx.conf /etc/nginx

EXPOSE 8000

CMD [ "/usr/sbin/nginx" ]