Skip to content

Commit

Permalink
fix(oci): give write access to config dir (#4)
Browse files Browse the repository at this point in the history
* create empty dir in builder stage
* copy to scratch image with right permissions

fixes #2

Signed-off-by: Frederik Zorn <federdaemn@mail.de>
Squash-merged-by: Frederik Zorn <federdaemn@mail.de>
  • Loading branch information
z0rrn authored Nov 15, 2023
1 parent b08db10 commit 00742cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions anki-sync-server/containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ ARG software_version
ARG TARGETARCH
ARG TARGETVARIANT

# see script
# create empty directory (to be copied into scratch image) a. see script
COPY ../tools/convert-arch-cargo.sh .
RUN sh ./convert-arch-cargo.sh
RUN mkdir /empty && sh ./convert-arch-cargo.sh

# upgrade system and install dependencies:
# protocol buffer compiler + gcc/g++ compiler for specific arch
Expand Down Expand Up @@ -58,6 +58,9 @@ FROM scratch
# copy /etc/passwd because docker cannot create one in a scratch container
COPY tools/minimal-passwd.txt /etc/passwd

#copy empty directory to anki config dir (make accessible for the user)
COPY --from=builder --chown=65534:65534 /empty /config

# copy binary from builder
COPY --from=builder /output/anki-sync-server /app/anki-sync-server

Expand Down
2 changes: 1 addition & 1 deletion tools/minimal-passwd.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
scratch-user:*:65534:65534:scratch-user:/nonexistent:/sbin/nologin
scratch-user:*:65534:65534:scratch-user:/config:/sbin/nologin

0 comments on commit 00742cd

Please sign in to comment.