Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rnijveld committed Apr 9, 2024
0 parents commit 03a3539
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
17 changes: 17 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build and push

permissions:
contents: read
packages: write

on:
push:
branches:
- main
schedule:
- cron: '15 2 * * SUN'

jobs:
build-and-push:
uses: ./.github/workflows/docker.yml
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Checks

permissions:
contents: read

on:
pull_request:

jobs:
build:
uses: ./.github/workflows/docker.yml
secrets: inherit
40 changes: 40 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker

on:
workflow_call:

jobs:
build:
strategy:
matrix:
include:
- version: stable
latest: false
- version: beta
latest: false
- version: nightly
latest: false
- version: 1.77
latest: true
- version: 1.76
latest: false
uses: "tweedegolf/actions-container-helpers/.github/workflows/container-image.yml@main"
with:
push: ${{ github.ref == 'refs/heads/main' }}
build-args: |
RUSTUP_VERSION=1.27.0
RUSTUP_SHA256_AMD64=a3d541a5484c8fa2f1c21478a6f6c505a778d473c21d60a18a4df5185d320ef8
RUSTUP_SHA256_ARM64=76cd420cb8a82e540025c5f97bda3c65ceb0b0661d5843e6ef177479813b0367
CARGO_BINSTALL_VERSION=1.6.4
CARGO_BINSTALL_SHA256_AMD64=c44726d931b0748bb8159d21be1fa1514c9fd60cd5f00defd6d8e7c1e835deac
CARGO_BINSTALL_SHA256_ARM64=0e5aa3daa7b76412c0ddacb575aeabdfd14ae6aeb8470399cac6cfbd77455514
SCCACHE_VERSION=0.7.7
SCCACHE_SHA256_AMD64=ed0010b4dcaccce42b9dc8699257134a113d0ca16dfb7db890356135218322c9
SCCACHE_SHA256_ARM64=e7ecabac9a703e53a8b06e84b0058fcf242239d164050537bc399387160320fb
CARGO_UDEPS_VERSION=0.1.47
CARGO_UDEPS_SHA256_AMD64=d98267271652f87c3516bf8623ebd86a3afcada304714e47cacdb0a96bb6df0c
CARGO_UDEPS_SHA256_ARM64=445c6ef1325d247a1e31481d34ecdd5a7ae87f702aff40cfa9dd8ce2ea8f2783
RUST_VERSION=${{matrix.version}}
tags: |
ghcr.io/tweedegolf/rust-dev:${{matrix.version}}
${{ matrix.latest && 'ghcr.io/tweedegolf/rust-dev:latest' || '' }}
178 changes: 178 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
FROM docker.tgrep.nl/docker/debian:bookworm

RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
unzip \
xz-utils \
zlib1g-dev \
libclang1 \
clang \
gdb \
lldb \
lld \
llvm \
cmake \
valgrind \
pkg-config \
libssl-dev \
libpq-dev \
libsqlite3-dev \
binaryen \
crossbuild-essential-amd64 \
crossbuild-essential-arm64 \
; \
rm -rf /var/lib/apt/lists/*;

ARG RUSTUP_VERSION
ENV RUSTUP_VERSION ${RUSTUP_VERSION}

ARG RUSTUP_SHA256_AMD64
ARG RUSTUP_SHA256_ARM64

ARG RUST_VERSION
ENV RUST_VERSION ${RUST_VERSION:-stable}

ARG RUST_COMPONENTS="rustfmt clippy rust-analysis rls rust-src"

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch="x86_64-unknown-linux-gnu"; rustupSha256=${RUSTUP_SHA256_AMD64} ;; \
arm64) rustArch="aarch64-unknown-linux-gnu"; rustupSha256=${RUSTUP_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O /usr/local/bin/rustup-init "https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${rustArch}/rustup-init"; \
if [ ! -z "${rustupSha256}" ]; then \
echo "${rustupSha256} */usr/local/bin/rustup-init" | sha256sum -c -; \
else \
echo "Checksum for rustup-init not verified"; \
fi; \
chmod +x /usr/local/bin/rustup-init; \
rustup-init -y --no-modify-path --default-toolchain "${RUST_VERSION}"; \
rustup target add wasm32-unknown-unknown; \
rustup target add aarch64-unknown-linux-gnu; \
rustup target add x86_64-unknown-linux-gnu; \
chmod -R a+rw ${RUSTUP_HOME} ${CARGO_HOME}; \
rm /usr/local/bin/rustup-init; \
rustup --version; \
cargo --version; \
rustc --version;

ARG SCCACHE_VERSION
ENV SCCACHE_VERSION ${SCCACHE_VERSION}

ARG SCCACHE_SHA256_AMD64
ARG SCCACHE_SHA256_ARM64

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) sccacheArch="x86_64-unknown-linux-musl"; sccacheSha256=${SCCACHE_SHA256_AMD64} ;; \
arm64) sccacheArch="aarch64-unknown-linux-musl"; sccacheSha256=${SCCACHE_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz" \
"https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz"; \
if [ ! -z "${sccacheSha256}" ]; then \
echo "${sccacheSha256} */tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz" | sha256sum -c -; \
else \
echo "Checksum for sccache not verified"; \
fi; \
cd /tmp; \
tar xvf "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz"; \
mv "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}/sccache" /usr/local/bin/sccache; \
chmod a+x /usr/local/bin/sccache; \
rm -rf "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}/"; \
rm -rf "/tmp/sccache-v${SCCACHE_VERSION}-${sccacheArch}.tar.gz"; \
sccache --version;

ARG CARGO_BINSTALL_VERSION
ENV CARGO_BINSTALL_VERSION ${CARGO_BINSTALL_VERSION}

ARG CARGO_BINSTALL_SHA256_AMD64
ARG CARGO_BINSTALL_SHA256_ARM64

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) cargo_binstall_arch="x86_64-unknown-linux-musl"; cargo_binstall_sha256=${CARGO_BINSTALL_SHA256_AMD64} ;; \
arm64) cargo_binstall_arch="aarch64-unknown-linux-musl"; cargo_binstall_sha256=${CARGO_BINSTALL_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O "/tmp/cargo-binstall-$cargo_binstall_arch.tgz" \
"https://github.com/cargo-bins/cargo-binstall/releases/download/v${CARGO_BINSTALL_VERSION}/cargo-binstall-$cargo_binstall_arch.tgz"; \
if [ ! -z "${cargo_binstall_sha256}" ]; then \
echo "${cargo_binstall_sha256} */tmp/cargo-binstall-${cargo_binstall_arch}.tgz" | sha256sum -c -; \
else \
echo "Checksum for cargo-binstall not verified"; \
fi; \
cd /tmp; \
tar xvf "/tmp/cargo-binstall-$cargo_binstall_arch.tgz"; \
mv /tmp/cargo-binstall /usr/local/bin/cargo-binstall; \
chmod a+x /usr/local/bin/cargo-binstall; \
rm -rf "/tmp/cargo-binstall-$cargo_binstall_arch.tgz"; \
cargo binstall -V;

RUN set -eux; \
cargo binstall --no-confirm \
cargo-audit \
cargo-outdated \
cargo-bloat \
cargo-llvm-lines \
cargo-watch \
cargo-edit \
cargo-chef \
cargo-sweep \
cargo-deny \
trunk \
mdbook \
wasm-bindgen-cli \
sqlx-cli; \
sqlx --version; \
wasm-bindgen --version; \
mdbook --version; \
trunk --version; \
cargo deny --version; \
cargo sweep --version; \
cargo chef --version; \
cargo upgrade --version; \
cargo llvm-lines --version; \
cargo bloat --version; \
cargo outdated --version; \
cargo audit --version;

ARG CARGO_UDEPS_VERSION
ENV CARGO_UDEPS_VERSION ${CARGO_UDEPS_VERSION}

ARG CARGO_UDEPS_SHA256_AMD64
ARG CARGO_UDEPS_SHA256_ARM64

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) udepsArch="x86_64-unknown-linux-musl"; udepsSha256=${CARGO_UDEPS_SHA256_AMD64} ;; \
arm64) udepsArch="aarch64-unknown-linux-musl"; udepsSha256=${CARGO_UDEPS_SHA256_ARM64} ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
wget -O "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz" \
"https://github.com/est31/cargo-udeps/releases/download/v${CARGO_UDEPS_VERSION}/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz"; \
if [ ! -z "${udepsSha256}" ]; then \
echo "${udepsSha256} */tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz" | sha256sum -c -; \
else \
echo "Checksum for cargo-udeps not verified"; \
fi; \
cd /tmp; \
tar xvf "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz"; \
mv "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}/cargo-udeps" /usr/local/cargo/bin/cargo-udeps; \
chmod a+x /usr/local/cargo/bin/cargo-udeps; \
rm -rf "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}/"; \
rm -rf "/tmp/cargo-udeps-v${CARGO_UDEPS_VERSION}-${udepsArch}.tar.gz"; \
cargo udeps --version;

# RUN cargo install diesel_cli --no-default-features --features "postgres sqlite"
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2024 Tweede Golf and Contributors

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Rust development Docker images

0 comments on commit 03a3539

Please sign in to comment.