-
Notifications
You must be signed in to change notification settings - Fork 31
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
add container definition #215
Conversation
I like this! Thank you for putting it together. I think it may be useful to use a BCI based image for the builder and expose the ports that How would you feel about something like this? # build the hauler binary
FROM registry.suse.com/bci/golang:1.21 AS builder
RUN zypper --non-interactive install make bash wget ca-certificates \
&& zypper clean -a
COPY . /build
WORKDIR /build
RUN make build
RUN echo "hauler:x:1001:1001::/home:" > /etc/passwd \
&& echo "hauler:x:1001:hauler" > /etc/group \
&& mkdir /store \
&& mkdir /store-files \
&& mkdir /registry
# build the minimal image
FROM scratch
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs/
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder --chown=hauler:hauler /tmp/. /tmp
COPY --from=builder --chown=hauler:hauler /home/. /home
COPY --from=builder --chown=hauler:hauler /store/. /store
COPY --from=builder --chown=hauler:hauler /registry/. /registry
COPY --from=builder --chown=hauler:hauler /store-files/. /store-files
COPY --from=builder --chown=hauler:hauler /build/bin/hauler /
USER hauler
EXPOSE 80 8080 5000
ENTRYPOINT [ "/hauler" ] |
Would we want to add a directory for |
@zackbradys I definitely like the idea of mounting in "hauls" like you were showing me in your example last week. Also, boss man @dweomer should be along soon to provide his feedback. I'm kinda leaning on him for this specific effort. |
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.
LGTM
Updated the purposed changes to the # build the hauler binary
FROM registry.suse.com/bci/golang:1.21 AS builder
RUN zypper --non-interactive install make bash wget ca-certificates \
&& zypper clean -a
COPY . /build
WORKDIR /build
RUN make build
RUN echo "hauler:x:1001:1001::/home:" > /etc/passwd \
&& echo "hauler:x:1001:hauler" > /etc/group \
&& mkdir /store \
&& mkdir /registry \
&& mkdir /store-files \
&& mkdir /hauls
# build the minimal image
FROM scratch
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs/
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder --chown=hauler:hauler /home/. /home
COPY --from=builder --chown=hauler:hauler /store/. /store
COPY --from=builder --chown=hauler:hauler /registry/. /registry
COPY --from=builder --chown=hauler:hauler /store-files/. /store-files
COPY --from=builder --chown=hauler:hauler /hauls/. /hauls
COPY --from=builder --chown=hauler:hauler /tmp/. /tmp
COPY --from=builder --chown=hauler:hauler /build/bin/hauler /
USER hauler
EXPOSE 80 8080 5000
ENTRYPOINT [ "/hauler" ] |
@zackbradys you should still be able to mount volumes wherever you like in the container, even if the path doesn't already exist. For example both of following work: $ docker run -v ./hauls:/hauls clanktron/hauler:stable store serve registry -s /hauls
7:37PM INF clanktron/carbide-images-api:latest
7:37PM INF copied artifacts to [127.0.0.1:35135]
7:37PM INF starting registry on port [5000]
$ docker run -v ./hauls:/doesnt/exist/hauls clanktron/hauler:stable store serve registry -s /doesnt/exist/hauls
7:37PM INF clanktron/carbide-images-api:latest
7:37PM INF copied artifacts to [127.0.0.1:35135]
7:37PM INF starting registry on port [5000] I only made a point to create /registry and /store-files since they're created ephemerally with the fileserver/registry and won't necessarily be a mounted volume. Technically the /store creation is unnecessary. |
Sure thing.
I feel like the EXPOSE directive is largely unnecessary since it doesn't actually affect anything (besides docker run -P, but you'd only want to expose one of those ports, not all).
Good catch, just added that. |
@amartin120 @zackbradys Gonna go ahead and merge unless you guys have some more suggestions. |
I agree that Have you tried running the container with a mounted volume that contains a haul like |
Thank you for upgrading the image! On the same note as my last note, I agree that |
@zackbradys If you mean like this yea docker run -v ./haul.tar.zst:/haul.tar.zst -v ./store:/store clanktron/hauler:stable store load haul.tar.zst
# 11:07PM INF loading content from [haul.tar.zst] to [store]
docker run -v ./store:/store clanktron/hauler:stable store serve registry
# 11:07PM INF neuvector/scanner:latest
Yea I say we just document it properly; default ports, CWD (aka /), the fact there's no shell, etc. |
Verification/Testing of Changes:
All commands were tested. Below is some sample usage.
Additional Context:
Minimal rootless container.