From ed1f2315b50fd38cbe261967b7132c179de55a49 Mon Sep 17 00:00:00 2001 From: Matthew Andres Moreno Date: Mon, 12 Feb 2024 22:18:48 -0500 Subject: [PATCH] Add Dockerfile, build Docker image in CI Deploy to ghcr.io --- .github/workflows/ci.yaml | 17 +++++++++++++++++ Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 Dockerfile diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4755c37e7..53f4b491c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,3 +52,20 @@ jobs: - name: Run tests run: | ./run_tests + + docker-build: + name: Docker Image Build + runs-on: ubuntu-22.04 + needs: tests + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v2 + - name: Build and Push to GitHub Container Registry + uses: docker/build-push-action@v1 + with: + push: true + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + repository: devosoft/avida + registry: ghcr.io + add_git_labels: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..c4052a718 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:22.04 + +# Install necessary packages +RUN apt-get update && apt-get install -y \ + git \ + cmake \ + g++ \ + make \ + ccache \ + libncurses5-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY . /avida +WORKDIR "/avida" + +RUN git submodule update --init --recursive + +# Build Avida +RUN ./build_avida + +# Set Avida executable as entrypoint +ENTRYPOINT ["/avida/cbuild/work/avida"]