Skip to content

Commit

Permalink
docker image test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Dec 22, 2023
1 parent 6441c3d commit 6f867f0
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pyc
__pycache__
44 changes: 44 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Docker Image

on:
push:
pull_request:

jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: fallenbreath
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
fallenbreath/chatbridge
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push
uses: docker/build-push-action@v4
with:
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
file: ./docker/Dockerfile
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
19 changes: 19 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG PYTHON_VERSION=3.11

FROM python:${PYTHON_VERSION} as builder

RUN pip3 install mcdreforged

COPY ../chatbridge /build/chatbridge
COPY ../lang /build/lang
COPY ../__main__.py LICENSE mcdreforged.plugin.json /build/
RUN cd /build && mcdreforged pack

FROM python:${PYTHON_VERSION}

COPY ../requirements.txt /app/
RUN pip3 install -r /app/requirements.txt

COPY --from=builder /build/ChatBridge.pyz /app/
WORKDIR /app
ENTRYPOINT ["python3", "ChatBridge.pyz"]
19 changes: 19 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'
services:
server:
container_name: chatbridge_server
restart: unless-stopped
image: fallenbreath/chatbridge:latest
command: server
volumes:
- ./ChatBridge_server.json:/app/ChatBridge_server.json
ports:
- '30001:30001'

khl_bot:
container_name: chatbridge_khl_bot
restart: unless-stopped
image: fallenbreath/chatbridge:latest
command: kaiheila_bot
volumes:
- ./ChatBridge_kaiheila.json:/app/ChatBridge_kaiheila.json

0 comments on commit 6f867f0

Please sign in to comment.