feat: self containerisation
Build oxker images, for x86, arm64v8, and armv6, and publish to Docker Hub
This commit is contained in:
-47
@@ -1,47 +0,0 @@
|
||||
#############
|
||||
## Builder ##
|
||||
#############
|
||||
|
||||
FROM rust:1.63.0-slim as builder
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
# Create blank project
|
||||
RUN USER=root cargo new oxker
|
||||
|
||||
# We want dependencies cached, so copy those first.
|
||||
COPY Cargo.toml Cargo.lock /usr/src/oxker/
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /usr/src/oxker
|
||||
|
||||
## Install target platform (Cross-Compilation) --> Needed for Alpine
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
|
||||
# This is a dummy build to get the dependencies cached.
|
||||
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||
|
||||
# Now copy in the rest of the sources
|
||||
COPY src /usr/src/oxker/src/
|
||||
|
||||
## Touch main.rs to prevent cached release build
|
||||
RUN touch /usr/src/oxker/src/main.rs
|
||||
|
||||
# This is the actual application build.
|
||||
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||
|
||||
#############
|
||||
## Runtime ##
|
||||
#############
|
||||
|
||||
FROM alpine:latest AS runtime
|
||||
|
||||
# Copy application binary from builder image
|
||||
COPY --from=builder /usr/src/oxker/target/x86_64-unknown-linux-musl/release/oxker /usr/local/bin
|
||||
COPY start_oxker.sh ./
|
||||
RUN chmod +x /start_oxker.sh
|
||||
|
||||
# Run the application
|
||||
ENTRYPOINT [ "./start_oxker.sh"]
|
||||
|
||||
# docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro oxker
|
||||
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img src='./.github/logo.svg' width='125px'/>
|
||||
<img src='./.github/logo.svg' width='100px'/>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -20,6 +20,12 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Run via Docker
|
||||
|
||||
Now published on <a href='https://hub.docker.com/r/mrjackwills/oxker' target='_blank' rel='noopener noreferrer'>Docker Hub</a>, with images built for `linux/amd64`, `linux/arm64v8`, and `linux/armv6`
|
||||
|
||||
`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro mrjackwills/oxker:latest`
|
||||
|
||||
|
||||
## Download & install
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<p align="center">
|
||||
<img src='https://raw.githubusercontent.com/mrjackwills/oxker/main/.github/logo.svg' width='100px'/>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<h1 align="center">oxker</h1>
|
||||
<div align="center">
|
||||
A simple tui to view & control docker containers
|
||||
</div>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://raw.githubusercontent.com/mrjackwills/oxker/main/.github/screenshot_01.jpg" target='_blank' rel='noopener noreferrer'>
|
||||
<img src='https://raw.githubusercontent.com/mrjackwills/oxker/main/.github/screenshot_01.jpg' width='60%'/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Run
|
||||
|
||||
Images built for `linux/amd64`, `linux/arm64v8`, and `linux/armv6`
|
||||
|
||||
`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro mrjackwills/oxker:latest`
|
||||
|
||||
## Help
|
||||
|
||||
visit the<a href="https://github.com/mrjackwills/oxker" target='_blank' rel='noopener noreferrer'> Github repo</a>
|
||||
@@ -0,0 +1,58 @@
|
||||
#############
|
||||
## Builder ##
|
||||
#############
|
||||
|
||||
FROM --platform=linux/amd64 rust:slim as builder
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER="aarch64-linux-gnu-gcc"
|
||||
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-lgcc"
|
||||
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER="arm-linux-gnueabihf-ld"
|
||||
|
||||
COPY ./containerised/platform.sh .
|
||||
|
||||
RUN chmod +x ./platform.sh && ./platform.sh
|
||||
|
||||
RUN apt-get update && apt-get install $(cat /.compiler) -y
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
# Create blank project
|
||||
RUN cargo new oxker
|
||||
|
||||
# We want dependencies cached, so copy those first
|
||||
COPY Cargo.toml Cargo.lock /usr/src/oxker/
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /usr/src/oxker
|
||||
|
||||
# Install target platform (Cross-Compilation)
|
||||
RUN rustup target add $(cat /.platform)
|
||||
|
||||
# This is a dummy build to get the dependencies cached
|
||||
RUN cargo build --target $(cat /.platform) --release
|
||||
|
||||
# Now copy in the rest of the sources
|
||||
COPY src /usr/src/oxker/src/
|
||||
|
||||
## Touch main.rs to prevent cached release build
|
||||
RUN touch /usr/src/oxker/src/main.rs
|
||||
|
||||
# This is the actual application build
|
||||
RUN cargo build --release --target $(cat /.platform)
|
||||
|
||||
RUN cp /usr/src/oxker/target/$(cat /.platform)/release/oxker /
|
||||
|
||||
#############
|
||||
## Runtime ##
|
||||
#############
|
||||
|
||||
FROM alpine:latest AS runtime
|
||||
|
||||
# Copy application binary from builder image
|
||||
COPY --from=builder /oxker /usr/local/bin
|
||||
COPY ./containerised/start_oxker.sh ./
|
||||
|
||||
# Run the application
|
||||
ENTRYPOINT [ "./start_oxker.sh"]
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker login
|
||||
|
||||
docker buildx prune
|
||||
|
||||
docker buildx build --platform linux/arm/v6,linux/arm64,linux/amd64 -t mrjackwills/oxker --push -f containerised/Dockerfile .
|
||||
|
||||
# Github as well?
|
||||
# docker buildx build --platform linux/arm/v6,linux/arm64,linux/amd64 -t ghcr.io/mrjackwills/oxker --push -f containerised/Dockerfile .
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Used in Docker build to set platform dependent variables
|
||||
|
||||
case $TARGETARCH in
|
||||
|
||||
"amd64")
|
||||
echo "x86_64-unknown-linux-musl" > /.platform
|
||||
echo "" > /.compiler
|
||||
;;
|
||||
"arm64")
|
||||
echo "aarch64-unknown-linux-musl" > /.platform
|
||||
echo "gcc-aarch64-linux-gnu" > /.compiler
|
||||
;;
|
||||
"arm")
|
||||
echo "arm-unknown-linux-musleabihf" > /.platform
|
||||
echo "gcc-arm-linux-gnueabihf" > /.compiler
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user