updated Dockerfile

This commit is contained in:
Marvin Zhang
2022-06-03 19:26:28 +08:00
parent a98e2a7085
commit ad031e0347
5 changed files with 18 additions and 32 deletions

View File

@@ -87,7 +87,7 @@ jobs:
cd $IMAGE_PATH_CRAWLAB_BACKEND
docker build . --file Dockerfile --tag image
- name: Log into registry
run: echo ${{ secrets.DOCKER_PASSWORD}} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push image
run: |
IMAGE_VERSION=${{needs.setup.outputs.version}}
@@ -109,7 +109,7 @@ jobs:
cd $IMAGE_PATH_CRAWLAB_FRONTEND
docker build . --file Dockerfile --tag image
- name: Log into registry
run: echo ${{ secrets.DOCKER_PASSWORD}} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push image
run: |
IMAGE_VERSION=${{needs.setup.outputs.version}}

View File

@@ -2,6 +2,8 @@ FROM crawlabteam/crawlab-backend:latest AS backend-build
FROM crawlabteam/crawlab-frontend:latest AS frontend-build
FROM crawlabteam/crawlab-public-plugins:latest AS public-plugins-build
# images
FROM crawlabteam/crawlab-base:latest
@@ -18,11 +20,11 @@ RUN cp /opt/bin/crawlab /usr/local/bin/crawlab-server
# copy frontend files
COPY --from=frontend-build /app/dist /app/dist
# copy public-plugins files
COPY --from=public-plugins-build /app/plugins /app/plugins
# copy nginx config files
COPY ./nginx/crawlab.conf /etc/nginx/conf.d
# install plugins
RUN /bin/bash /app/bin/docker-install-plugins.sh
# start backend
CMD ["/bin/bash", "/app/bin/docker-init.sh"]

View File

@@ -1,4 +1,4 @@
FROM golang:1.16
FROM golang:1.16 AS build
WORKDIR /go/src/app
COPY . .
@@ -9,3 +9,7 @@ ENV GO111MODULE on
RUN go mod tidy \
&& go install -v ./...
FROM alpine:3.14
# copy files
COPY --from=backend-build /go/bin/crawlab /go/bin/crawlab

View File

@@ -1,25 +0,0 @@
#!/bin/bash
function install_plugin() {
# plugins executables directory
local bin_path="/app/plugins/bin"
if [ -d $bin_path ]; then
:
else
mkdir -p "$bin_path"
fi
# plugin name
local name=$1
local url="https://github.com/crawlab-team/${name}"
local repo_path=""/app/plugins/${name}
git clone "$url" "$repo_path"
cd "$repo_path" && go build -o "${bin_path}/${name}"
chmod +x "${bin_path}/${name}"
}
plugin_names="plugin-dependency plugin-notification plugin-spider-assistant"
for name in $plugin_names; do
install_plugin "$name"
done

View File

@@ -1,4 +1,4 @@
FROM node:12
FROM node:12 AS build
ADD . /app
WORKDIR /app
@@ -6,3 +6,8 @@ RUN rm /app/.npmrc
# install frontend
RUN yarn install && yarn run build:docker
FROM alpine:3.14
# copy files
COPY --from=build /app/dist /app/dist