Add dev containers, musl build
This commit is contained in:
parent
23cd51fc95
commit
1748dd2fb6
11 changed files with 115 additions and 49 deletions
23
containers/Containerfile.alpine
Normal file
23
containers/Containerfile.alpine
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
FROM alpine:latest
|
||||
MAINTAINER Juno Takano juno@jutty.dev
|
||||
ENV DEBUG=debug
|
||||
ENV TAG=${TAG:-latest}
|
||||
|
||||
# Setup tooling
|
||||
RUN apk add curl clang git file
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
|
||||
# Install
|
||||
RUN git clone -b "$TAG" --single-branch https://codeberg.org/jutty/en /build
|
||||
RUN <<EOF
|
||||
cd /build && /root/.cargo/bin/cargo build --locked --release
|
||||
mv /build/target/release/en /usr/local/bin/en
|
||||
rm -rf /build
|
||||
EOF
|
||||
|
||||
# Describe
|
||||
RUN file $(which en) && sha256sum $(which en)
|
||||
|
||||
# Launch
|
||||
WORKDIR /root
|
||||
CMD ["en", "-p", "80"]
|
||||
13
containers/Containerfile.alpine-dev
Normal file
13
containers/Containerfile.alpine-dev
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FROM docker.io/library/rust:alpine
|
||||
MAINTAINER Juno Takano juno@jutty.dev
|
||||
ENV DEBUG=debug
|
||||
|
||||
# Install
|
||||
COPY en /usr/local/bin/en
|
||||
|
||||
# Describe
|
||||
RUN sha256sum $(which en)
|
||||
|
||||
# Launch
|
||||
WORKDIR /root
|
||||
CMD ["en", "-p", "80"]
|
||||
24
containers/Containerfile.debian
Normal file
24
containers/Containerfile.debian
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
FROM debian:stable-slim
|
||||
MAINTAINER Juno Takano juno@jutty.dev
|
||||
ENV DEBUG=debug
|
||||
ENV TAG=${TAG:-latest}
|
||||
|
||||
# Setup tooling
|
||||
RUN apt-get -y --update install --no-install-recommends \
|
||||
curl ca-certificates gcc libc6-dev git file
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
|
||||
# Install
|
||||
RUN git clone -b "$TAG" --single-branch https://codeberg.org/jutty/en /build
|
||||
RUN <<EOF
|
||||
cd /build && /root/.cargo/bin/cargo build --locked --release
|
||||
mv /build/target/release/en /usr/local/bin/en
|
||||
rm -rf /build
|
||||
EOF
|
||||
|
||||
# Describe
|
||||
RUN file $(which en) && sha256sum $(which en)
|
||||
|
||||
# Launch
|
||||
WORKDIR /root
|
||||
CMD ["en", "-p", "80"]
|
||||
13
containers/Containerfile.debian-dev
Normal file
13
containers/Containerfile.debian-dev
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FROM debian:stable-slim
|
||||
MAINTAINER Juno Takano juno@jutty.dev
|
||||
ENV DEBUG=debug
|
||||
|
||||
# Install
|
||||
COPY en /usr/local/bin/en
|
||||
|
||||
# Describe
|
||||
RUN sha256sum $(which en)
|
||||
|
||||
# Launch
|
||||
WORKDIR /root
|
||||
CMD ["en", "-p", "80"]
|
||||
2
containers/README.md
Normal file
2
containers/README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
## Known issues
|
||||
- Containers will halt and fail to respond to requests with `ERR_CONNECTION_RESET` if the working directory is `/`
|
||||
23
containers/build.sh
Executable file
23
containers/build.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -eu
|
||||
suffix=$(printf '%s' "$1" | sed 's/.*\.//')
|
||||
tag="en:$suffix"
|
||||
|
||||
if podman container exists "$tag"; then
|
||||
podman stop --time 3 "$tag"
|
||||
fi
|
||||
|
||||
if [ "$suffix" = 'debian-dev' ]; then
|
||||
cp -v ../target/x86_64-unknown-linux-gnu/release/en en
|
||||
elif [ "$suffix" = 'alpine-dev' ]; then
|
||||
cp -v ../target/x86_64-unknown-linux-musl/release/en en
|
||||
fi
|
||||
|
||||
podman build \
|
||||
--tag "$tag" \
|
||||
-f "Containerfile.$suffix"
|
||||
|
||||
if [ -f en ]; then
|
||||
rm -v en
|
||||
fi
|
||||
12
containers/run.sh
Executable file
12
containers/run.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -eu
|
||||
suffix=$(printf '%s' "$1" | sed 's/.*\.//')
|
||||
name="en-$suffix"
|
||||
tag="en:$suffix"
|
||||
|
||||
podman run \
|
||||
--replace \
|
||||
--name "$name" \
|
||||
--publish 3008:80 \
|
||||
"$tag"
|
||||
Loading…
Add table
Add a link
Reference in a new issue