Update Dockerfile and add docker-compose.yml

This commit is contained in:
Sofía Aritz 2024-01-05 16:35:54 +01:00
parent 871a859dfc
commit 76d53e60a2
Signed by: sofia
GPG key ID: 90B5116E3542B28F
4 changed files with 49 additions and 9 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
config/ayb.toml

View file

@ -1,23 +1,41 @@
FROM alpine:latest FROM rust:1-slim-buster
WORKDIR . WORKDIR .
ENV GIT_REPO https://github.com/marcua/ayb ENV GIT_REPO https://github.com/marcua/ayb
ENV CHECKOUT main
RUN apt update
RUN apt install -y \
build-essential \
libssl-dev \
openssl \
autoconf \
bison \
flex \
gcc \
g++ \
git \
libprotobuf-dev \
libnl-route-3-dev \
libtool \
make \
pkg-config \
protobuf-compiler
RUN apk add git clang lld rust cargo openssl openssl-dev
RUN git clone $GIT_REPO RUN git clone $GIT_REPO
# Build nsjail
RUN git clone https://github.com/google/nsjail
RUN cd ./nsjail && make && mv nsjail ../ayb
WORKDIR ./ayb WORKDIR ./ayb
COPY . . COPY . .
RUN git fetch --tags RUN git fetch --tags
RUN git checkout $(git describe --tags `git rev-list --tags --max-count=1`) RUN git checkout $CHECKOUT
RUN cargo build --release RUN cargo build --release
RUN echo "#!/bin/sh" >> create_config RUN cargo build --release
RUN echo "[ ! -f ayb.toml ] && cargo run --release -- default_server_config > ayb.toml" >> create_config
RUN chmod +x create_config
RUN /ayb/create_config
CMD ["cargo", "run", "--release"]
EXPOSE 5433 EXPOSE 5433
CMD ["./target/release/ayb", "server"]

View file

@ -1,3 +1,15 @@
# aybDocker # aybDocker
Package list available here: [Packages](https://git.sofiaritz.com/sofia/aybDocker/packages) Package list available here: [Packages](https://git.sofiaritz.com/sofia/aybDocker/packages)
## Config file
## Isolation
aybDocker builds `nsjail`. Make sure your `ayb.toml` contains the following
```toml
[isolation]
nsjail_path = "./nsjail"
```

9
docker-compose.yml Normal file
View file

@ -0,0 +1,9 @@
version: "3"
services:
aybServer:
image: git.sofiaritz.com/sofia/ayb:nightly
restart: unless-stopped
volumes:
- ./config/ayb.toml:/ayb/ayb.toml
ports:
- "127.0.0.1:5433:5433"