Skip to content

Improve Dockerfile and add push workflow#141

Merged
aht007 merged 1 commit intomasterfrom
aht007/push-ci-image-to-dockerhub
Oct 20, 2022
Merged

Improve Dockerfile and add push workflow#141
aht007 merged 1 commit intomasterfrom
aht007/push-ci-image-to-dockerhub

Conversation

@aht007
Copy link
Contributor

@aht007 aht007 commented Oct 14, 2022

This PR improves the existing codejail Dockerfile. We copy code files after installing the requirements so that changes to code don't bust the cached requirements layers in docker image.
This PR also adds git package in Dockerfile so that we can use it to fetch recent changes while running tests on PRs.
Finally this PR also adds a push workflow to push latest CI image to ECR.

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y vim python3-virtualenv python3-pip
RUN apt-get install -y sudo
RUN apt-get install -y sudo git
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding git package for subsequent PR, where we will use it for fetching latest changes to repo while running tests in CI

WORKDIR /codejail

# Clone Requirement files
COPY ./requirements/sandbox.txt ./codejail/requirements/sandbox.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Improvement to the image building process. Requirements Cache wouldn't be busted this way if there are code changes but no change to requirements file.


# Setup sudoers file
ADD sudoers-file/01-sandbox /etc/sudoers.d/01-sandbox
COPY sudoers-file/01-sandbox /etc/sudoers.d/01-sandbox
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are just copying local files and hence COPY command is the most suitable one for that.

@aht007 aht007 merged commit f4cd479 into master Oct 20, 2022
@aht007 aht007 deleted the aht007/push-ci-image-to-dockerhub branch October 20, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants