Skip to content

Commit

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

fixes #2
Signed-off-by: Frederik Zorn <federdaemn@mail.de>
  • Loading branch information
z0rrn committed Nov 15, 2023
1 parent d7f0ef8 commit f2b960f
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 the 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 give 'scratch-user' access to it
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 f2b960f

Please sign in to comment.