diff --git a/Dockerfile b/Dockerfile index c60dfaa6..f9aec9f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,30 +6,19 @@ FROM crawlabteam/crawlab-frontend:${CRAWLAB_TAG} AS frontend-build FROM crawlabteam/crawlab-base:${CRAWLAB_TAG} -# copy backend files -RUN mkdir -p /opt/bin -COPY --from=backend-build /go/bin/crawlab /opt/bin -RUN cp /opt/bin/crawlab /usr/local/bin/crawlab-server - -# copy backend config files -COPY ./backend/conf /app/backend/conf - -# copy frontend files +# Copy files +COPY --from=backend-build /go/bin/crawlab /usr/local/bin/crawlab-server COPY --from=frontend-build /app/dist /app/dist - -# copy nginx config files +COPY ./backend/conf /app/backend/conf COPY ./docker/nginx/crawlab.conf /etc/nginx/conf.d +COPY ./docker/bin/docker-init.sh /app/bin/docker-init.sh -# copy docker bin files -RUN mkdir -p /app/bin -COPY ./docker/bin/* /app/bin - -# start backend +# Start backend CMD ["/bin/bash", "/app/bin/docker-init.sh"] -# frontend port +# Frontend port EXPOSE 8080 -# healthcheck for backend +# Healthcheck for backend HEALTHCHECK --interval=1m --timeout=3s \ CMD curl -f http://localhost:8000/health || exit 1 \ No newline at end of file diff --git a/docker/bin/docker-init.sh b/docker/bin/docker-init.sh index 3f49f824..ed6a9d05 100644 --- a/docker/bin/docker-init.sh +++ b/docker/bin/docker-init.sh @@ -1,6 +1,12 @@ #!/bin/bash -# replace default api path to new one -python /app/bin/update_docker_js_api_address.py +if [ "${CRAWLAB_MASTER_NODE}" == "Y" ]; then + # Replace default api path to new one + python /app/bin/update_docker_js_api_address.py + # Start nginx + service nginx start +fi + +# Start backend crawlab-server server diff --git a/docker/ghcr/.docker-compose.yml.swp b/docker/ghcr/.docker-compose.yml.swp deleted file mode 100644 index fe323879..00000000 Binary files a/docker/ghcr/.docker-compose.yml.swp and /dev/null differ diff --git a/docker/ghcr/docker-compose.yml b/docker/ghcr/docker-compose.yml index 8cf732c7..d135a326 100644 --- a/docker/ghcr/docker-compose.yml +++ b/docker/ghcr/docker-compose.yml @@ -10,12 +10,7 @@ services: - "8080:8080" depends_on: - mongo - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/health"] - interval: 30s - timeout: 10s - retries: 5 - + worker: image: ghcr.io/crawlab-team/crawlab:${CRAWLAB_TAG:-develop} container_name: crawlab_ghcr_worker @@ -24,11 +19,6 @@ services: CRAWLAB_MASTER_HOST: "master" depends_on: - master - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/health"] - interval: 30s - timeout: 10s - retries: 5 - + mongo: image: mongo:5