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

Reworked docker docs #155

Merged
merged 9 commits into from
Oct 29, 2024
Merged

Reworked docker docs #155

merged 9 commits into from
Oct 29, 2024

Conversation

regularfry
Copy link
Contributor

Description

Minor (but important!) changes to how docker is run, DOCKER_IMAGE handling, and some docs.

Context

This change wraps up a few different changes I needed to make when using the template.

Docker context

Here we were cding into the infrastructure/images/whatever directory before running Docker. That restricts the docker context to only that directory and below. You can't COPY ../../. . or whatever because that's treated as a security problem.

This meant that you couldn't put your application code into a container inside the infrastructure/images structure. That's fine if you've got a single application container, and if you're happy with it living at the root of the repo, but as soon as you've got more than one it gets a bit messy (and I've never liked things that clutter the repo root at the best of times).

The change I've made gets rid of the cd in and out; docker is always run from the repo root. That means paths in Dockerfiles are relative to the root, not to themselves; same with .dockerignore (which I've made optional so that it doesn't break if there isn't one).

$DOCKER_IMAGE variable handling

Minor tweak but a good quality of life improvement here. If you specify $DOCKER_IMAGE to the make docker-* tasks but not $dir then it defaults $dir to infrastructure/images/$DOCKER_IMAGE. That means the make invocation, the filesystem, and the docker image list are all synchronised to the same name, by convention.

Updated docker usage docs

The example in the existing docs was specific to repackaging a third party tool, but gave no guidance about how to package your own application code. I've rewritten the Quick start section to show packaging a trivial python script. I'm a little worried that the docs are a bit repetitive now, but I don't think it's worth reworking right now.

I've also removed the python example code. It was a good start, but in practice having the tutorial docs is better because what I want to know as a new user is where to put my own stuff, and the example wasn't a huge help there and in fact was a bit of a confusion.

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@regularfry regularfry requested a review from stefaniuk March 15, 2024 16:07
@stefaniuk stefaniuk force-pushed the alyo12-docker-docs branch from 29ef7b1 to 9964263 Compare April 17, 2024 12:51
stefaniuk
stefaniuk previously approved these changes Apr 17, 2024
Copy link
Contributor

@stefaniuk stefaniuk left a comment

Choose a reason for hiding this comment

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

A lot of good work went into this. The manual reads well. Approving this PR.

Some suggestions:

  • Could we arrange for collegues who use the repo template to give us a feedback on the usage of the Docker module? I may ask the screening DToS team. We are also planning to implement devcontainers which may benefit from some of the functionality here.
  • All the new docker scripts, can we include them in the scripts/docker/tests/docker.test.sh test suite?

Copy link
Contributor

@stefaniuk stefaniuk left a comment

Choose a reason for hiding this comment

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

LGTM

@regularfry regularfry added this pull request to the merge queue Oct 29, 2024
Merged via the queue into main with commit 438b8af Oct 29, 2024
23 checks passed
@regularfry regularfry deleted the alyo12-docker-docs branch October 29, 2024 10:07
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