Add container image build script

bugfix/ci-buildah
Dustin 2025-03-08 21:15:16 -06:00
parent 15227125b9
commit ff832df721
2 changed files with 54 additions and 0 deletions

5
.containerignore Normal file
View File

@ -0,0 +1,5 @@
*
!Cargo.*
!js/
!src/
!templates/

49
Containerfile Normal file
View File

@ -0,0 +1,49 @@
FROM git.pyrocufflink.net/containerimages/dch-base AS build
RUN --mount=type=cache,target=/var/cache \
microdnf install -y \
--setopt persistdir=/var/cache/dnf \
--setopt install_weak_deps=0 \
cargo \
openssl-devel \
&& :
WORKDIR /build
COPY Cargo.* .
COPY src src
RUN --mount=type=cache,target=/root/.cargo \
cargo build --release --locked
FROM git.pyrocufflink.net/containerimages/dch-base AS esbuild
RUN --mount=type=cache,target=/var/cache \
microdnf install -y \
--setopt persistdir=/var/cache/dnf \
--setopt install_weak_deps=0 \
npm \
&& :
WORKDIR /build
COPY js .
RUN --mount=type=cache,target=/root/.cargo \
npm ci && npm run build
FROM git.pyrocufflink.net/containerimages/dch-base
COPY --from=build /build/target/release/receipts /usr/local/bin
COPY --from=esbuild /build/dist /usr/local/share/receipts/static
COPY templates /usr/local/share/receipts/templates
WORKDIR /usr/local/share/receipts
ENTRYPOINT ["/usr/local/bin/receipts"]
CMD ["/etc/receipts/config.toml"]