Browse Source

feat: add Dockerfile (#600)

HEAD
yehong GitHub 2 years ago
parent
commit
b27a9a925d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 11 deletions
  1. +1
    -11
      .github/workflows/build.yml
  2. +18
    -0
      Dockerfile
  3. +8
    -0
      docker-entrypoint.sh

+ 1
- 11
.github/workflows/build.yml View File

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

+ 18
- 0
Dockerfile View File

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

+ 8
- 0
docker-entrypoint.sh View File

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

Loading…
Cancel
Save