Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #4759 venus-auth: add docker feature #80

Merged
merged 10 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/build_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,14 @@ jobs:
--data-urlencode "link=$link" \
--data-urlencode "description=message:${{steps.vars.outputs.git_message}}, branch:${{steps.vars.outputs.branch}}, commit:${{steps.vars.outputs.short}}, tag:${{steps.vars.outputs.github_tag}}" \
--data-urlencode "version=${{steps.vars.outputs.short}}"
set -e
set -e

- name: Publish the Docker image
if: ${{ github.ref_type == 'tag' && github.event_name == 'create' }}
run: |
docker build . --file dockerfile --tag filvenus/venus-auth:latest
docker tag filvenus/venus-auth:latest filvenus/venus-auth:${{steps.vars.outputs.github_tag }}
docker login --username=filvenus --password ${{ secrets.DOCKER_PASSWORD }}
docker push filvenus/venus-auth:${{steps.vars.outputs.github_tag }}
docker push filvenus/venus-auth:latest

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
venus-auth
coverage.*
coverage.*
.vscode
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,22 @@ linux: clean
clean:
rm -rf venus-auth

.PHONY: clean
.PHONY: clean


.PHONY: docker

BUILD_DOCKER_PROXY=

static:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GOFLAGS) -o venus-auth ./cmd/server/*.go

docker-buildenv:
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) -t filvenus/venus-buildenv -f docker/venus-buildenv.dockerfile .

docker-runtime:
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) -t filvenus/venus-runtime -f docker/venus-runtime.dockerfile .


docker:
docker build --build-arg https_proxy=$(BUILD_DOCKER_PROXY) -t venus-auth .
17 changes: 17 additions & 0 deletions docker/script/compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

echo $@
/app/venus-auth run &

sleep 1

echo "regist admin"
/app/venus-auth user add --name="admin"
token=`/app/venus-auth token gen --perm admin admin`
/app/venus-auth user active admin

echo "token:"
echo ${token#*: }
echo "${token#*: }" > /env/token

wait
20 changes: 20 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM filvenus/venus-buildenv AS buildenv

RUN git clone https://github.com/filecoin-project/venus-auth.git --depth 1
RUN export GOPROXY=https://goproxy.cn && cd venus-auth && make linux


FROM filvenus/venus-runtime

# DIR for app
WORKDIR /app

# copy the app from build env
COPY --from=buildenv /go/venus-auth/venus-auth /app/venus-auth
COPY ./docker/script /script

EXPOSE 8989

ENTRYPOINT ["/app/venus-auth","run"]