Skip to content

Commit

Permalink
ci: automate quic-network-simulator docker image build & push
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Jan 15, 2024
1 parent 6fb7a6c commit 3be5848
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 56 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nss
nspr
target
47 changes: 47 additions & 0 deletions .github/workflows/qns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: qns # (quic-network-simulator)

on:
push:
branches: ["main", "docker"] # TODO: remove docker
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"]
pull_request:
branches: ["main"]
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-qns
tags: |
# default
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
file: qns/Dockerfile
23 changes: 5 additions & 18 deletions qns/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.45.2
RUST_VERSION=1.70.0

RUN set -eux; \
curl -sSLf "https://static.rust-lang.org/rustup/archive/1.22.1/x86_64-unknown-linux-gnu/rustup-init" -o rustup-init; \
Expand All @@ -33,35 +33,22 @@ RUN set -eux; \

RUN "$NSS_DIR"/build.sh --static -Ddisable_tests=1 -o

# Copy the .git directory from the local clone so that it is possible to create
# an image that includes local updates.
RUN mkdir -p /neqo-reference
ADD . /neqo-reference
RUN if [ -d /neqo-reference/.git ]; then \
source=/neqo-reference; \
else \
source=https://github.com/mozilla/neqo; \
fi; \
git clone --depth 1 --branch "$NEQO_BRANCH" "$source" /neqo; \
rm -rf /neqo-reference
ADD . /neqo

RUN set -eux; \
cd /neqo; \
RUSTFLAGS="-g -C link-arg=-fuse-ld=lld" cargo build --release \
--bin neqo-client --bin neqo-server; \
cp target/release/neqo-client target; \
cp target/release/neqo-server target; \
rm -rf target/release
--bin neqo-client --bin neqo-server;

# Copy only binaries to the final image to keep it small.

FROM martenseemann/quic-network-simulator-endpoint:latest

ENV LD_LIBRARY_PATH=/neqo/lib
COPY --from=buildimage /neqo/target/neqo-client /neqo/target/neqo-server /neqo/bin/
COPY --from=buildimage /neqo/target/release/neqo-client /neqo/target/release/neqo-server /neqo/bin/
COPY --from=buildimage /dist/Release/lib/*.so /neqo/lib/
COPY --from=buildimage /dist/Release/bin/certutil /dist/Release/bin/pk12util /neqo/bin/

COPY interop.sh /neqo/
COPY qns/interop.sh /neqo/
RUN chmod +x /neqo/interop.sh
ENTRYPOINT [ "/neqo/interop.sh" ]
38 changes: 0 additions & 38 deletions qns/update.sh

This file was deleted.

0 comments on commit 3be5848

Please sign in to comment.