chore: clean up Containerfile and document "/etc" behavior
- We don't have any files remaining in "./etc/" in this repo. - We could add a ".gitkeep" file to it, to keep the "empty" directory, but then that file would get automatically merged as a hidden file into the final image, which is silly. - So let's just document the proper location to place things instead, which is "usr/etc/". - The Containerfile has also been cleaned up to be a bit easier to follow along what it's doing, such as putting the "copy scripts" step closer to the actual running of the scripts.
This commit is contained in:
@@ -4,30 +4,32 @@ ARG BASE_IMAGE_URL=ghcr.io/ublue-os/silverblue-main
|
|||||||
FROM ${BASE_IMAGE_URL}:${FEDORA_MAJOR_VERSION}
|
FROM ${BASE_IMAGE_URL}:${FEDORA_MAJOR_VERSION}
|
||||||
ARG RECIPE
|
ARG RECIPE
|
||||||
|
|
||||||
# copy over configuration files
|
# Copy static configurations and component files.
|
||||||
# etc is copied to /usr/etc/ to prevent "merge conflicts"
|
# Warning: If you want to place anything in "/etc" of the final image, you MUST
|
||||||
# as it is the proper directory for "system" configuration files
|
# place them in "./usr/etc" in your repo, so that they're written to "/usr/etc"
|
||||||
# and /etc/ is for editing by the local admin
|
# on the final system. That is the proper directory for "system" configuration
|
||||||
# see issue #28 (https://github.com/ublue-os/startingpoint/issues/28)
|
# templates on immutable Fedora distros, whereas the normal "/etc" is ONLY meant
|
||||||
COPY etc /usr/etc
|
# for manual overrides and editing by the machine's admin AFTER installation!
|
||||||
|
# See issue #28 (https://github.com/ublue-os/startingpoint/issues/28).
|
||||||
COPY usr /usr
|
COPY usr /usr
|
||||||
|
|
||||||
# copy scripts
|
# Copy recipe.
|
||||||
|
COPY ${RECIPE} /usr/share/ublue-os/recipe.yml
|
||||||
|
|
||||||
|
# "yq" used in build.sh and the setup-flatpaks recipe to read the recipe.yml.
|
||||||
|
# Copied from the official container image since it's not available as an RPM.
|
||||||
|
COPY --from=docker.io/mikefarah/yq /usr/bin/yq /usr/bin/yq
|
||||||
|
|
||||||
|
# Copy scripts.
|
||||||
RUN mkdir /tmp/scripts
|
RUN mkdir /tmp/scripts
|
||||||
COPY scripts /tmp/scripts
|
COPY scripts /tmp/scripts
|
||||||
RUN find /tmp/scripts -type f -exec chmod +x {} \;
|
RUN find /tmp/scripts -type f -exec chmod +x {} \;
|
||||||
|
|
||||||
COPY ${RECIPE} /usr/share/ublue-os/recipe.yml
|
# Copy and run the build script.
|
||||||
|
|
||||||
# yq used in build.sh and the setup-flatpaks recipe to read the recipe.yml
|
|
||||||
# copied from the official container image as it's not avaible as an rpm
|
|
||||||
COPY --from=docker.io/mikefarah/yq /usr/bin/yq /usr/bin/yq
|
|
||||||
|
|
||||||
# copy and run the build script
|
|
||||||
COPY build.sh /tmp/build.sh
|
COPY build.sh /tmp/build.sh
|
||||||
RUN chmod +x /tmp/build.sh && /tmp/build.sh
|
RUN chmod +x /tmp/build.sh && /tmp/build.sh
|
||||||
|
|
||||||
# clean up and finalize container build
|
# Clean up and finalize container build.
|
||||||
RUN rm -rf \
|
RUN rm -rf \
|
||||||
/tmp/* \
|
/tmp/* \
|
||||||
/var/* && \
|
/var/* && \
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ The easiest way to start customizing is by looking at and modifying `recipe.yml`
|
|||||||
|
|
||||||
For the base-image field, you can use any other native container image. You will get all the features of that image, plus the ones added here! Check out the [uBlue images list](https://ublue.it/images/) to decide what to use!
|
For the base-image field, you can use any other native container image. You will get all the features of that image, plus the ones added here! Check out the [uBlue images list](https://ublue.it/images/) to decide what to use!
|
||||||
|
|
||||||
If you want to add custom configuration files, you can just add them in the `etc` directory. If you need to add other directories, you can look at the Containerfile to see how it's done. Writing to any directories under `/var` in Fedora Silverblue are not supported and will not work, as those are user-managed.
|
If you want to add custom configuration files, you can just add them in the `usr/etc/` directory, which is the official OSTree "configuration template" directory. If you need to add other directories, you can look at the Containerfile to see how it's done. Writing to `/etc` or `/var` in Fedora's immutable OSTree-based distros *isn't supported* and will not work, as those are user-managed locations!
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
> The configuration files you put in the `etc` directory are actually added to `/usr/etc/` where they get applied to your local `/etc/` when rebasing to or updating the image. If a config file in `/etc/` has been changed, the changes won't be overridden, but the new version will be available in `/usr/etc/`. Run `sudo ostree admin config-diff` to see the difference between `/etc/` and `/usr/etc/` (`man ostree-admin-config-diff` for further documentation).
|
> The configuration files you put in the `usr/etc/` directory are actually added to `/usr/etc/` on the final system, where they will be automatically applied to your local `/etc/` when rebasing to or updating the image. If a config file in `/etc/` has been changed by the user, OSTree will attempt to automatically merge the user's changes into the installed file, but if that fails, the new version will only be available in `/usr/etc/`. Run `sudo ostree admin config-diff` to see the difference between `/etc/` and `/usr/etc/` (`man ostree-admin-config-diff` for further documentation).
|
||||||
|
|
||||||
### Custom build scripts
|
### Custom build scripts
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user