Server Docker Image Github CI. (#331)

ci: Update Dockerfile to match Github CI.
ci: Create Docker Image Workflow.
This commit is contained in:
Trance233 2024-03-30 16:16:52 +08:00 committed by GitHub
parent 1209ca43fa
commit 31891631d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 9 deletions

43
.github/workflows/docker-server.yml vendored Normal file
View File

@ -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 }}

View File

@ -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"]