Skip to content

Commit

Permalink
twoliter: embed .dockerignore
Browse files Browse the repository at this point in the history
The build system has very specific requirements on what to include in
the Docker build context in order to work as expected. Embedding the
file avoids the need for a synchronized change in other projects when
updating Twoliter.

Signed-off-by: Ben Cressey <[email protected]>
  • Loading branch information
bcressey authored and webern committed Dec 7, 2023
1 parent 7d38b08 commit 8658a7f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions twoliter/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fn main() {
));

paths.copy_file("Dockerfile");
paths.copy_file("Dockerfile.dockerignore");
paths.copy_file("Makefile.toml");
paths.copy_file("docker-go");
paths.copy_file("partyplanner");
Expand Down
4 changes: 2 additions & 2 deletions twoliter/embedded/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ARG TOKEN
# We can't create directories via RUN in a scratch container, so take an existing one.
COPY --chown=1000:1000 --from=sdk /tmp /cache
# Ensure the ARG variables are used in the layer to prevent reuse by other builds.
COPY --chown=1000:1000 .dockerignore /cache/.${PACKAGE}.${ARCH}.${TOKEN}
COPY --chown=1000:1000 .gitignore /cache/.${PACKAGE}.${ARCH}.${TOKEN}

# =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^=
# Some builds need to modify files in the source directory, for example Rust software using
Expand All @@ -52,7 +52,7 @@ ARG TOKEN
# We can't create directories via RUN in a scratch container, so take an existing one.
COPY --chown=1000:1000 --from=sdk /tmp /variantcache
# Ensure the ARG variables are used in the layer to prevent reuse by other builds.
COPY --chown=1000:1000 .dockerignore /variantcache/.${PACKAGE}.${ARCH}.${VARIANT}.${TOKEN}
COPY --chown=1000:1000 .gitignore /variantcache/.${PACKAGE}.${ARCH}.${VARIANT}.${TOKEN}

# =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^=
# Builds an RPM package from a spec file.
Expand Down
12 changes: 12 additions & 0 deletions twoliter/embedded/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/.git
/.gomodcache
/build/*
!/build/rpms/
/build/rpms/*
!/build/rpms/*.rpm
/build/rpms/*-debuginfo-*.rpm
/build/rpms/*-debugsource-*.rpm
!/build/tools/*
**/target/*
/sbkeys
/tests

0 comments on commit 8658a7f

Please sign in to comment.