diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 97ff760..048f9e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -151,14 +151,4 @@ jobs: target: STANDARD platforms: linux/amd64,linux/arm64 push: true - tags: casbin/casibase:${{steps.get-current-tag.outputs.tag }},casbin/casibase:latest - - - name: Push All In One Version to Docker Hub - uses: docker/build-push-action@v3 - if: github.repository == 'casbin/casibase' && github.event_name == 'push' && steps.should_push.outputs.push=='true' - with: - context: . - target: ALLINONE - platforms: linux/amd64,linux/arm64 - push: true - tags: casbin/casibase-all-in-one:${{steps.get-current-tag.outputs.tag }},casbin/casibase-all-in-one:latest + tags: casbin/casibase:${{steps.get-current-tag.outputs.tag }},casbin/casibase:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6568191 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM golang:1.19 AS BACK +WORKDIR /go/src/casibase +COPY . . +RUN go build -o server ./main.go + + +FROM debian:latest AS STANDARD +LABEL MAINTAINER="https://casibase.org/" +ARG TARGETOS +ARG TARGETARCH +ENV BUILDX_ARCH="${TARGETOS:-linux}_${TARGETARCH:-amd64}" + +WORKDIR / +COPY --from=BACK /go/src/casibase/ ./ + + +ENTRYPOINT ["/bin/bash"] +CMD ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..28b1aee --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [ "${MYSQL_ROOT_PASSWORD}" = "" ] ;then MYSQL_ROOT_PASSWORD=123456 ;fi + +service mariadb start + +mysqladmin -u root password ${MYSQL_ROOT_PASSWORD} + +exec /server --createDatabase=true \ No newline at end of file