forked from Maurice/pastabble
Merge pull request 'build: use docker for building instead of the host' (#1) from fix-dockerfile into main
Reviewed-on: Maurice/pastabble#1
This commit is contained in:
commit
293a0af9c5
17
Dockerfile
17
Dockerfile
@ -1,8 +1,21 @@
|
|||||||
|
FROM rust:alpine3.18 AS builder
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
RUN apk add --no-cache musl-dev
|
||||||
|
COPY . ./
|
||||||
|
RUN apk --print-arch
|
||||||
|
RUN case "$(apk --print-arch)" in \
|
||||||
|
x86_64) cargo build --target x86_64-unknown-linux-musl --release; \
|
||||||
|
mv ./target/x86_64-unknown-linux-musl /release ;; \
|
||||||
|
aarch64) cargo build --target aarch64-unknown-linux-musl --release; \
|
||||||
|
mv ./target/aarch64-unknown-linux-musl /release ;; \
|
||||||
|
esac
|
||||||
|
|
||||||
FROM alpine:edge
|
FROM alpine:edge
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./target/x86_64-unknown-linux-musl/release/ /app
|
COPY --from=builder /release/* /app
|
||||||
COPY ./about.html /app/about.html
|
COPY ./about.html /app/about.html
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD [ "./pastabble" ]
|
CMD [ "./pastabble" ]
|
||||||
|
9
build.sh
9
build.sh
@ -1,7 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cargo build --target x86_64-unknown-linux-musl --release
|
cargo build --target x86_64-unknown-linux-musl --release
|
||||||
podman build -t pastabble:latest .
|
podman build -t pastabble:latest .
|
||||||
podman save --format oci-archive -o pastabble.tar pastabble
|
|
||||||
|
|
||||||
# load with podman load -i pastabble.tar
|
# publish
|
||||||
# run with podman run -p 8080:8080 --name pastabble-c -v pastabble-v:/data -it pastabble
|
# podman build --arch=arm64 . -t git.plabble.org/{user}/pastabble
|
||||||
|
# podman push git.plabble.org/{user}/pastabble
|
||||||
|
|
||||||
|
# run
|
||||||
|
# podman run -p 8080:8080 --name pastabble-c -v pastabble-v:/data -it pastabble
|
||||||
|
Loading…
x
Reference in New Issue
Block a user