🐳 build: set up app package for ptth_relay Docker images
parent
498d69eeb9
commit
10465dfb46
|
@ -1,3 +1,5 @@
|
||||||
/config
|
/config
|
||||||
|
/ptth_build_*
|
||||||
|
/ptth_server_build_*
|
||||||
/ptth_latest.tar.gz
|
/ptth_latest.tar.gz
|
||||||
/target
|
/target
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/config
|
|
||||||
/*.tar.gz
|
/*.tar.gz
|
||||||
|
/app_packages
|
||||||
|
/config
|
||||||
/ptth_server.toml
|
/ptth_server.toml
|
||||||
/ptth_relay.toml
|
/ptth_relay.toml
|
||||||
/ptth_build_L6KLMVS6/
|
/ptth_build_L6KLMVS6/
|
||||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -4,8 +4,6 @@
|
||||||
# rust:1.48-slim-buster
|
# rust:1.48-slim-buster
|
||||||
FROM rust@sha256:cb6b98346ef41a2062d4d8f099127d880f2ef7c1515d00215fc9ea713b99167b as build
|
FROM rust@sha256:cb6b98346ef41a2062d4d8f099127d880f2ef7c1515d00215fc9ea713b99167b as build
|
||||||
|
|
||||||
#RUN apk add libseccomp-dev
|
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
ENV USER root
|
ENV USER root
|
||||||
|
|
||||||
|
@ -62,21 +60,21 @@ cargo build --release -p ptth_relay && \
|
||||||
cargo test --release -p ptth_relay
|
cargo test --release -p ptth_relay
|
||||||
|
|
||||||
# debian:buster-slim
|
# debian:buster-slim
|
||||||
FROM debian@sha256:240f770008bdc538fecc8d3fa7a32a533eac55c14cbc56a9a8a6f7d741b47e33
|
FROM debian@sha256:13f0764262a064b2dd9f8a828bbaab29bdb1a1a0ac6adc8610a0a5f37e514955
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get upgrade -y \
|
&& apt-get upgrade -y \
|
||||||
&& apt-get install -y libssl1.1 ca-certificates tini
|
&& apt-get install -y libssl1.1 ca-certificates tini
|
||||||
|
|
||||||
RUN addgroup --gid 10001 nonroot && adduser --system --uid 10000 --gid 10001 nonroot
|
RUN addgroup --gid 10001 ptth_user && adduser --system --uid 10000 --gid 10001 ptth_user
|
||||||
|
|
||||||
USER nonroot
|
USER ptth_user
|
||||||
WORKDIR /home/nonroot
|
WORKDIR /home/ptth_user
|
||||||
|
|
||||||
COPY --from=build /ptth/target/release/ptth_relay ./
|
COPY --from=build /ptth/target/release/ptth_relay ./
|
||||||
COPY --from=build /ptth/handlebars ./handlebars
|
COPY --from=build /ptth/handlebars/relay ./handlebars/relay
|
||||||
|
|
||||||
ARG git_version
|
ARG git_version
|
||||||
RUN echo -n "$git_version" > ./git_version.txt
|
RUN echo -n "$git_version" > ./git_version.txt
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/tini", "--", "./ptth_relay"]
|
CMD ["/usr/bin/tini", "--", "./ptth_relay"]
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# debian:buster-slim
|
||||||
|
FROM debian@sha256:13f0764262a064b2dd9f8a828bbaab29bdb1a1a0ac6adc8610a0a5f37e514955
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get upgrade -y \
|
||||||
|
&& apt-get install -y libssl1.1 ca-certificates tini
|
||||||
|
|
||||||
|
RUN addgroup --gid 10001 ptth_user && adduser --system --uid 10000 --gid 10001 ptth_user
|
||||||
|
|
||||||
|
USER ptth_user
|
||||||
|
WORKDIR /home/ptth_user
|
||||||
|
|
||||||
|
COPY ./run_app_package.bash ./
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/tini", "--", "bash", "./run_app_package.bash"]
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
GIT_COMMITISH=$(git rev-parse main)
|
||||||
|
|
||||||
|
mkdir -p app_packages
|
||||||
|
|
||||||
|
git archive --format=tar "$GIT_COMMITISH" | sudo docker build -t ptth:latest --build-arg "git_version=$GIT_COMMITISH" -
|
||||||
|
|
||||||
|
sudo docker run --rm ptth:latest tar -c ptth_relay handlebars | gzip > app_packages/garbage.tar.gz
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
tar -xf "$1"
|
||||||
|
|
||||||
|
exec ./ptth_relay
|
Loading…
Reference in New Issue