Add container image build script
parent
15227125b9
commit
ff832df721
|
@ -0,0 +1,5 @@
|
|||
*
|
||||
!Cargo.*
|
||||
!js/
|
||||
!src/
|
||||
!templates/
|
|
@ -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"]
|
Loading…
Reference in New Issue