move dockerfile for building packages to different location
This commit is contained in:
parent
4791e1dd84
commit
1f2d2edbd9
4 changed files with 41 additions and 24 deletions
20
Cargo.lock
generated
20
Cargo.lock
generated
|
@ -516,24 +516,24 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
|||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.31"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.93"
|
||||
version = "1.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
|
||||
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.38"
|
||||
version = "1.0.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||
checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
@ -619,9 +619,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.98"
|
||||
version = "2.0.99"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
|
||||
checksum = "e02e925281e18ffd9d640e234264753c43edc62d64b2d4cf898f1bc5e75f3fc2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -691,9 +691,9 @@ checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
|
||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
|
|
22
Dockerfile
22
Dockerfile
|
@ -1,16 +1,12 @@
|
|||
FROM rust:slim
|
||||
ARG UID="1000"
|
||||
ARG GID="1000"
|
||||
FROM git.brysonsteck.xyz/brysonsteck/refractr:latest
|
||||
|
||||
WORKDIR /usr/src/refractr
|
||||
COPY . .
|
||||
# replace "path/" with the path containing your refractr configs
|
||||
COPY path/ /etc/refractr
|
||||
|
||||
RUN apt update && apt install pkg-config libssl-dev -y
|
||||
RUN cargo build --release
|
||||
RUN cargo install --locked --path .
|
||||
# use --secret with docker build to specify your ssh key
|
||||
# make sure your configs use the location below
|
||||
RUN --mount=type=secret,id=key,target=/id.pub \
|
||||
cp /id.pub /etc/refractr && chmod 400 /etc/refractr/id.pub
|
||||
|
||||
RUN groupadd -g $GID refractr
|
||||
RUN useradd -u $UID -g $GID -MN refractr
|
||||
USER refractr
|
||||
|
||||
CMD ["refractr"]
|
||||
# add arguments to specify verbosity and configs as needed
|
||||
CMD ["refractr", "-c", "/etc/refractr/config.json"]
|
||||
|
|
6
build
6
build
|
@ -2,12 +2,16 @@
|
|||
# Create all the different builds for refractr
|
||||
|
||||
version=$(cat Cargo.toml | grep -m1 version | awk -F' ' '{print $3}' | sed 's|"||g')
|
||||
uid=$(id -u)
|
||||
gid=$(id -g)
|
||||
cargo update
|
||||
cargo clean
|
||||
|
||||
# docker builds
|
||||
docker build -t refractr:$version .
|
||||
docker build -t refractr:$version --build-arg UID=$uid --build-arg GID=$gid -f package.Dockerfile .
|
||||
docker tag refractr:$version refractr:latest
|
||||
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:latest
|
||||
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:$version
|
||||
|
||||
# rust build
|
||||
cargo build
|
||||
|
|
17
package.Dockerfile
Normal file
17
package.Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
FROM rust:slim
|
||||
ARG UID="1000"
|
||||
ARG GID="1000"
|
||||
|
||||
WORKDIR /usr/src/refractr
|
||||
COPY . .
|
||||
|
||||
RUN apt update && apt install pkg-config libssl-dev -y
|
||||
RUN cargo build --release
|
||||
RUN cargo install --locked --path .
|
||||
|
||||
RUN groupadd -g $GID refractr
|
||||
RUN useradd -u $UID -g $GID -MN refractr
|
||||
RUN mkdir /etc/refractr && chown refractr:refractr /etc/refractr
|
||||
USER refractr
|
||||
|
||||
CMD ["refractr"]
|
Loading…
Add table
Reference in a new issue