0.36.12: docker fixes
This commit is contained in:
1 parent
76f42b5864
commit
f8fc228af1
5 files changed
+50
-26
No files matched your search
+30
-7
@@ -1,26 +1,49 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM rust:1.99-trixie AS build
|
|
||||||
|
FROM rust:1.99.1-trixie AS build
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN if [ ! -f Cargo.lock ]; then cargo generate-lockfile; fi \
|
RUN if [ ! -f Cargo.lock ]; then cargo generate-lockfile; fi \
|
||||||
&& cargo build --locked --release
|
&& cargo build --locked --release
|
||||||
|
|
||||||
|
|
||||||
FROM debian:trixie-slim AS runtime
|
FROM debian:trixie-slim AS runtime
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends ca-certificates python3 python3-venv python3-pip openssl certbot \
|
&& apt-get install -y --no-install-recommends \
|
||||||
python3-certbot-dns-cloudflare python3-certbot-dns-ovh python3-certbot-dns-rfc2136 \
|
ca-certificates \
|
||||||
|
python3 \
|
||||||
|
python3-venv \
|
||||||
|
python3-pip \
|
||||||
|
openssl \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& groupadd --system --gid 10001 rustproxy \
|
&& groupadd --system --gid 10001 rustproxy \
|
||||||
&& useradd --system --uid 10001 --gid rustproxy --home /var/lib/rustproxy --shell /usr/sbin/nologin rustproxy \
|
&& useradd \
|
||||||
|
--system \
|
||||||
|
--uid 10001 \
|
||||||
|
--gid rustproxy \
|
||||||
|
--home /var/lib/rustproxy \
|
||||||
|
--shell /usr/sbin/nologin \
|
||||||
|
rustproxy \
|
||||||
&& install -d -o rustproxy -g rustproxy -m 0700 /var/lib/rustproxy \
|
&& install -d -o rustproxy -g rustproxy -m 0700 /var/lib/rustproxy \
|
||||||
&& install -d -o rustproxy -g rustproxy -m 0750 /var/log/rustproxy
|
&& install -d -o rustproxy -g rustproxy -m 0750 /var/log/rustproxy
|
||||||
|
|
||||||
COPY --from=build /build/target/release/rust-proxy /usr/local/bin/rust-proxy
|
COPY --from=build /build/target/release/rust-proxy /usr/local/bin/rust-proxy
|
||||||
|
|
||||||
USER rustproxy:rustproxy
|
USER rustproxy:rustproxy
|
||||||
ENV RUST_PROXY_DATA_DIR=/var/lib/rustproxy \
|
|
||||||
|
ENV RUST_LOG=rust_proxy=info,warn \
|
||||||
|
RUST_PROXY_DATA_DIR=/var/lib/rustproxy \
|
||||||
|
RUST_PROXY_ADMIN_LISTEN=0.0.0.0:9090 \
|
||||||
RUST_PROXY_PROXY_LISTEN=0.0.0.0:8080 \
|
RUST_PROXY_PROXY_LISTEN=0.0.0.0:8080 \
|
||||||
RUST_PROXY_ADMIN_LISTEN=127.0.0.1:9090 \
|
RUST_PROXY_TLS_LISTEN=0.0.0.0:8443 \
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
VOLUME ["/var/lib/rustproxy"]
|
VOLUME ["/var/lib/rustproxy"]
|
||||||
|
|
||||||
EXPOSE 8080 8443 9090
|
EXPOSE 8080 8443 9090
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/rust-proxy"]
|
ENTRYPOINT ["/usr/local/bin/rust-proxy"]
|
||||||
CMD ["serve"]
|
CMD ["serve", "--allow-remote-admin"]
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
# Zot / OCI registry. Do not include a path in REGISTRY.
|
# Zot / OCI registry. Do not include a path in REGISTRY.
|
||||||
REGISTRY=zot.example.net
|
REGISTRY=oci.example.net
|
||||||
IMAGE_NAME=network/rustproxy
|
IMAGE_NAME=network/rustproxy
|
||||||
|
|
||||||
# Alternative shorthand instead of REGISTRY + IMAGE_NAME:
|
# Alternative shorthand instead of REGISTRY + IMAGE_NAME:
|
||||||
# OCI_IMAGE=zot.example.net/network/rustproxy
|
# OCI_IMAGE=oci.example.net/network/rustproxy
|
||||||
|
|
||||||
# Zot Basic Auth / htpasswd or token credentials.
|
# oci Basic Auth / htpasswd or token credentials.
|
||||||
OCI_USERNAME=
|
OCI_USERNAME=
|
||||||
OCI_PASSWORD=
|
OCI_PASSWORD=
|
||||||
# OCI_TOKEN=
|
# OCI_TOKEN=
|
||||||
@@ -14,8 +14,8 @@ OCI_PASSWORD=
|
|||||||
BUILD_PLATFORMS=linux/amd64,linux/arm64
|
BUILD_PLATFORMS=linux/amd64,linux/arm64
|
||||||
BUILDER=rustproxy-routeros
|
BUILDER=rustproxy-routeros
|
||||||
|
|
||||||
# RustProxy currently requires Rust 1.88.
|
# RustProxy currently requires Rust 1.99.1.
|
||||||
RUST_VERSION=1.88
|
RUST_VERSION=1.99.1
|
||||||
DEBIAN_SUITE=trixie
|
DEBIAN_SUITE=trixie
|
||||||
|
|
||||||
# Empty OCI_TAG means the script uses Cargo.toml package version.
|
# Empty OCI_TAG means the script uses Cargo.toml package version.
|
||||||
@@ -29,11 +29,11 @@ OCI_NO_CACHE=0
|
|||||||
OCI_VERIFY=1
|
OCI_VERIFY=1
|
||||||
OCI_PROGRESS=plain
|
OCI_PROGRESS=plain
|
||||||
|
|
||||||
# 1 stores BuildKit cache in Zot as IMAGE_NAME:buildcache.
|
# 1 stores BuildKit cache in oci as IMAGE_NAME:buildcache.
|
||||||
# Recommended for CI/ephemeral buildx builders.
|
# Recommended for CI/ephemeral buildx builders.
|
||||||
OCI_REGISTRY_CACHE=0
|
OCI_REGISTRY_CACHE=0
|
||||||
|
|
||||||
# Optional BuildKit config, useful for an internal Zot with a custom CA.
|
# Optional BuildKit config, useful for an internal oci with a custom CA.
|
||||||
# BUILDER_CONFIG=/etc/buildkit/buildkitd.toml
|
# BUILDER_CONFIG=/etc/buildkit/buildkitd.toml
|
||||||
|
|
||||||
# Optional manual repository root override.
|
# Optional manual repository root override.
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM rust:1.99-trixie AS build
|
FROM rust:1.99.1-trixie AS build
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
@@ -43,18 +43,18 @@ cp integrations/routeros-oci-build/.env.routeros.example \
|
|||||||
integrations/routeros-oci-build/.env
|
integrations/routeros-oci-build/.env
|
||||||
```
|
```
|
||||||
|
|
||||||
Then edit the Zot address and credentials.
|
Then edit the oci address and credentials.
|
||||||
|
|
||||||
## Zot example
|
## oci example
|
||||||
|
|
||||||
```env
|
```env
|
||||||
REGISTRY=zot.example.net
|
REGISTRY=oci.example.net
|
||||||
IMAGE_NAME=network/rustproxy
|
IMAGE_NAME=network/rustproxy
|
||||||
OCI_USERNAME=builder
|
OCI_USERNAME=builder
|
||||||
OCI_PASSWORD=secret
|
OCI_PASSWORD=secret
|
||||||
|
|
||||||
BUILD_PLATFORMS=linux/amd64,linux/arm64
|
BUILD_PLATFORMS=linux/amd64,linux/arm64
|
||||||
RUST_VERSION=1.88
|
RUST_VERSION=1.99.1
|
||||||
DEBIAN_SUITE=trixie
|
DEBIAN_SUITE=trixie
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -80,9 +80,9 @@ ENV_FILE=integrations/routeros-oci-build/.env \
|
|||||||
For example, with RustProxy version `0.36.12` and the defaults this publishes:
|
For example, with RustProxy version `0.36.12` and the defaults this publishes:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
zot.example.net/network/rustproxy:0.36.12
|
oci.example.net/network/rustproxy:0.36.12
|
||||||
zot.example.net/network/rustproxy:latest
|
oci.example.net/network/rustproxy:latest
|
||||||
zot.example.net/network/rustproxy:routeros
|
oci.example.net/network/rustproxy:routeros
|
||||||
```
|
```
|
||||||
|
|
||||||
Each tag points to the same amd64 + arm64 OCI manifest.
|
Each tag points to the same amd64 + arm64 OCI manifest.
|
||||||
@@ -112,13 +112,13 @@ For short-lived CI builders, enable registry cache:
|
|||||||
OCI_REGISTRY_CACHE=1
|
OCI_REGISTRY_CACHE=1
|
||||||
```
|
```
|
||||||
|
|
||||||
It is stored in Zot as:
|
It is stored in oci as:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
zot.example.net/network/rustproxy:buildcache
|
oci.example.net/network/rustproxy:buildcache
|
||||||
```
|
```
|
||||||
|
|
||||||
## Custom/self-signed Zot CA
|
## Custom/self-signed oci CA
|
||||||
|
|
||||||
Point `BUILDER_CONFIG` to a BuildKit configuration that trusts the registry CA, for example:
|
Point `BUILDER_CONFIG` to a BuildKit configuration that trusts the registry CA, for example:
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ Docker itself must also trust the registry CA for `docker login` and manifest in
|
|||||||
|
|
||||||
- Docker Engine
|
- Docker Engine
|
||||||
- Docker Buildx
|
- Docker Buildx
|
||||||
- access to the Zot/OCI registry
|
- access to the oci/OCI registry
|
||||||
- an existing RustProxy `Cargo.lock`
|
- an existing RustProxy `Cargo.lock`
|
||||||
|
|
||||||
Do not add an ARM-native Rust builder stage. Doing that would put `rustc` and Cargo back under QEMU on an amd64 host.
|
Do not add an ARM-native Rust builder stage. Doing that would put `rustc` and Cargo back under QEMU on an amd64 host.
|
||||||
Reference in new issue
Block a user