-
Notifications
You must be signed in to change notification settings - Fork 49
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
Update Makefile.docker-base #965
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
# -*- makefile -*- | ||
# Makefile for Docker image setup | ||
|
||
help: | ||
@echo "This should be run as part of the Dockerfile" | ||
false | ||
|
||
user-setup: | ||
# Create app group and user | ||
groupadd --gid 1000 app | ||
useradd -d /app --uid 1000 --gid app app | ||
chown -R app:app /app | ||
|
||
apt-setup: | ||
# Configure APT to keep downloaded packages | ||
rm -f /etc/apt/apt.conf.d/docker-clean | ||
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache | ||
|
||
apt-install: | ||
DEBIAN_FRONTEND=noninteractive apt update | ||
# gcc and python3-dev needed on arm for guidance | ||
DEBIAN_FRONTEND=noninteractive apt -y install --no-install-recommends python3-poetry gcc python3-dev | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't lose this comment. It's very important to understand why we're installing gcc & python3-dev (which otherwise we wouldn't expect to need). |
||
# Install necessary packages without recommended packages | ||
DEBIAN_FRONTEND=noninteractive apt update && \ | ||
DEBIAN_FRONTEND=noninteractive apt -y install --no-install-recommends python3-poetry gcc python3-dev && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to do the && thing here. |
||
# Clean up to reduce image size | ||
apt clean && rm -rf /var/lib/apt/lists/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't want this because of the caching. From docker-base/Dockerfile.buildx
The first two lines are caching the directories, so they don't show up in the image. You can verify that on the existing containers:
|
||
|
||
non-root-files-check: | ||
# Check for any files owned by root | ||
find . -uid 0 -ls | ||
test $$(find . -uid 0 -print | wc -w) = 0 | ||
|
||
record-version: | ||
# Ensure GIT_COMMIT is set and record the version | ||
test "$(GIT_COMMIT)" != "" | ||
test "$(GIT_COMMIT)" != "unknown" | ||
touch .git.commit.$(GIT_COMMIT) | ||
|
||
# Allow images that depend on the docker base image to verify that the version for their | ||
# source code is consistent with the version in the base image. If the code is inconsistent, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't get rid of the longer comment that explains why we are doing this. |
||
# the resulting image could behave unexpectedly. | ||
check-version-compatibility: | ||
# Verify the version consistency | ||
test "$(GIT_COMMIT)" != "" | ||
test "$(GIT_COMMIT)" != "unknown" | ||
ls .git.commit.* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we cache them as part of the build so want them to be retained.