From 31891631d700319029af75403274801500e7a59b Mon Sep 17 00:00:00 2001 From: Trance233 <57557139+popjdh@users.noreply.github.com> Date: Sat, 30 Mar 2024 16:16:52 +0800 Subject: [PATCH] Server Docker Image Github CI. (#331) ci: Update Dockerfile to match Github CI. ci: Create Docker Image Workflow. --- .github/workflows/docker-server.yml | 43 +++++++++++++++++++++++++++++ docker/Dockerfile | 15 ++++------ 2 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/docker-server.yml diff --git a/.github/workflows/docker-server.yml b/.github/workflows/docker-server.yml new file mode 100644 index 00000000..3fb44531 --- /dev/null +++ b/.github/workflows/docker-server.yml @@ -0,0 +1,43 @@ +name: Docker - Server +on: + push: + tags: + - "v*" + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-server + +jobs: + nightly: + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + tags: | + type=semver,pattern={{version}} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + context: . + file: docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 1ee51984..60ce0e88 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,19 +1,17 @@ -FROM ubuntu +FROM debian USER root +COPY . /FreeKill + #update apt dependencies RUN apt update -y && apt upgrade -y -#install git -RUN apt install git -y -#fetch for the lastest code of freekill -RUN git clone https://gitee.com/notify-ctrl/FreeKill #install compile tools -RUN apt install -y gcc g++ cmake || true +RUN apt install -y gcc g++ cmake RUN apt install -y liblua5.4-dev libsqlite3-dev libreadline-dev libssl-dev libgit2-dev swig qt6-base-dev qt6-tools-dev-tools #change workdir to FreeKill -WORKDIR FreeKill +WORKDIR /FreeKill #compile source code RUN mkdir build && cd build && cp -r /usr/include/lua5.4/* ../include && cmake .. -DFK_SERVER_ONLY= @@ -24,5 +22,4 @@ RUN ln -s build/FreeKill EXPOSE 9527 -#optional to override -# CMD ["/FreeKill/build/FreeKill", "-s"] +ENTRYPOINT ["/FreeKill/FreeKill", "-s"]