feat: update dockerfiles

This commit is contained in:
Jun Kurihara 2023-07-31 23:03:11 +09:00
commit 53f058f96d
5 changed files with 51 additions and 15 deletions

View file

@ -9,6 +9,7 @@ FROM --platform=$BUILDPLATFORM base AS builder
ENV CFLAGS=-Ofast
ENV BUILD_DEPS curl make ca-certificates build-essential
ENV TARGET_SUFFIX=unknown-linux-gnu
WORKDIR /tmp
@ -37,11 +38,11 @@ RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS ${
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable && \
export PATH="$HOME/.cargo/bin:$PATH" && \
echo "Install toolchain" && \
rustup target add $(cat /arch)-unknown-linux-gnu &&\
rustup target add $(cat /arch)-${TARGET_SUFFIX} && \
echo "Building rpxy from source" && \
cargo build --release --target=$(cat /arch)-unknown-linux-gnu ${CARGO_FEATURES} && \
strip --strip-all /tmp/target/$(cat /arch)-unknown-linux-gnu/release/rpxy &&\
cp /tmp/target/$(cat /arch)-unknown-linux-gnu/release/rpxy /tmp/target/release/rpxy
cargo build --release --target=$(cat /arch)-${TARGET_SUFFIX} ${CARGO_FEATURES} && \
strip --strip-all /tmp/target/$(cat /arch)-${TARGET_SUFFIX}/release/rpxy &&\
cp /tmp/target/$(cat /arch)-${TARGET_SUFFIX}/release/rpxy /tmp/target/release/rpxy
########################################
FROM --platform=$TARGETPLATFORM base AS runner

View file

@ -0,0 +1,34 @@
version: "3"
services:
rpxy-rp:
image: jqtype/rpxy
container_name: rpxy
init: true
restart: unless-stopped
ports:
- 127.0.0.1:8080:8080/tcp
- 127.0.0.1:8443:8443/udp
- 127.0.0.1:8443:8443/tcp
build:
context: ../
additional_contexts: # Uncomment when you build with musl
- messense/rust-musl-cross:amd64-musl=docker-image://messense/rust-musl-cross:x86_64-musl
- messense/rust-musl-cross:arm64-musl=docker-image://messense/rust-musl-cross:aarch64-musl
dockerfile: ./docker/Dockerfile.slim # based on alpine and build x86_64-unknown-linux-musl
platforms: # Choose your platforms
- "linux/amd64"
# - "linux/arm64"
environment:
- LOG_LEVEL=debug
- LOG_TO_FILE=true
- HOST_USER=jun
- HOST_UID=501
- HOST_GID=501
# - WATCH=true
tty: false
privileged: true
volumes:
- ./log:/rpxy/log
- ../example-certs/server.crt:/certs/server.crt:ro
- ../example-certs/server.key:/certs/server.key:ro
- ../config-example.toml:/etc/rpxy.toml:ro

View file

@ -6,17 +6,18 @@ services:
init: true
restart: unless-stopped
ports:
- 127.0.0.1:8080:8080
- 127.0.0.1:8443:8443
- 127.0.0.1:8080:8080/tcp
- 127.0.0.1:8443:8443/udp
- 127.0.0.1:8443:8443/tcp
build:
context: ../
# args: # Specify when build quic-s2n version
# - "CARGO_FEATURES=--no-default-features --features http3-s2n"
# - "ADDITIONAL_DEPS=pkg-config libssl-dev cmake libclang1 gcc g++"
dockerfile: ./docker/Dockerfile
args: # Uncomment when build quic-s2n version
- "CARGO_FEATURES=--no-default-features --features http3-s2n"
- "ADDITIONAL_DEPS=pkg-config libssl-dev cmake libclang1 gcc g++"
dockerfile: ./docker/Dockerfile # based on ubuntu 22.04 and build x86_64-unknown-linux-gnu
platforms: # Choose your platforms
# - "linux/amd64"
- "linux/arm64"
- "linux/amd64"
# - "linux/arm64"
environment:
- LOG_LEVEL=debug
- LOG_TO_FILE=true