Add Docker (#58)

This commit is contained in:
Hossin Asaadi
2022-11-16 19:06:32 +03:30
committed by GitHub
parent bb419976a7
commit abc67e8bd4
4 changed files with 24 additions and 6 deletions

View File

@@ -3,7 +3,12 @@ on:
push:
branches: [ master ]
workflow_dispatch:
inputs:
project:
description: 'Project'
required: true
default:
jobs:
build:
@@ -40,5 +45,5 @@ jobs:
docker buildx build \
--platform=linux/amd64,linux/arm64 \
--output "type=image,push=true" \
--file ${{ secrets.DOCKER_HUB_REPOSITORY }}/Dockerfile ./${{ secrets.DOCKER_HUB_REPOSITORY }} \
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest
--file ./Dockerfile ./ \
--tag $(echo "${DOCKERHUB_USERNAME}" | tr '[:upper:]' '[:lower:]')/${{ github.event.inputs.project }}:latest

View File

@@ -5,10 +5,13 @@ RUN go build main.go
FROM debian:11-slim
LABEL org.opencontainers.image.authors="hossin.asaadi77@gmail.com"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends -y ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV TZ=Asia/Shanghai
WORKDIR /root
COPY --from=builder /root/main /root/x-ui
COPY bin/. /root/bin/.
COPY ./bin/. /root/bin/.
VOLUME [ "/etc/x-ui" ]
CMD [ "./x-ui" ]

View File

@@ -115,7 +115,7 @@ systemctl restart x-ui
## Install using docker
> This docker tutorial and docker image are provided by [Chasing66](https://github.com/Chasing66)
> This docker tutorial and docker image are provided by [hossinasaadi](https://github.com/hossinasaadi)
1. install docker
@@ -131,7 +131,7 @@ docker run -itd --network=host \
-v $PWD/db/:/etc/x-ui/ \
-v $PWD/cert/:/root/cert/ \
--name x-ui --restart=unless-stopped \
enwaiax/x-ui:latest
hossinasaadi/x-ui:latest
```
> Build your own image

10
docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
version: '3.9'
services:
xui:
image: hossinasaadi/x-ui
container_name: x-ui
volumes:
- $PWD/db/:/etc/x-ui/
- $PWD/cert/:/root/cert/
restart: unless-stopped
network_mode: host