diff --git a/.circleci/config.yml b/.circleci/config.yml index 698bfef5..eb8f088d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,7 +86,7 @@ jobs: version: 20.10.18 - run: | for cmd in << pipeline.parameters.cmds >>; do - docker build -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:latest . + docker build --build-arg cmd=${cmd} -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:latest . done publish_docker: @@ -102,7 +102,7 @@ jobs: TAG=${CIRCLE_TAG:1} TAG=${TAG:-latest} for cmd in << pipeline.parameters.cmds >>; do - docker build -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:${TAG} . + docker build --build-arg cmd=${cmd} -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:${TAG} . docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}" docker push robocupssl/${cmd}:${TAG} done @@ -127,7 +127,8 @@ workflows: filters: { branches: { ignore: /.*/ }, tags: { only: /^v.*/ } } docker: jobs: - - build_docker + - build_docker: + filters: { branches: { ignore: master } } - publish_docker: context: docker hub filters: { branches: { only: master }, tags: { only: /^v.*/ } } diff --git a/cmd/ssl-game-controller/Dockerfile b/cmd/ssl-game-controller/Dockerfile index 8caa08af..0cbb6d51 100644 --- a/cmd/ssl-game-controller/Dockerfile +++ b/cmd/ssl-game-controller/Dockerfile @@ -9,11 +9,11 @@ ARG cmd=ssl-game-controller WORKDIR work COPY . . COPY --from=build_node frontend/dist frontend/dist -RUN go install -v ./cmd/${cmd} +RUN go install ./cmd/${cmd} # Start fresh from a smaller image FROM alpine:3 -ARG cmd +ARG cmd=ssl-game-controller COPY --from=build_go /go/bin/${cmd} /app/${cmd} RUN mkdir -p config && chown -R 1000: config USER 1000 diff --git a/cmd/ssl-ref-client/Dockerfile b/cmd/ssl-ref-client/Dockerfile index 0f25a277..90d651b9 100644 --- a/cmd/ssl-ref-client/Dockerfile +++ b/cmd/ssl-ref-client/Dockerfile @@ -6,7 +6,7 @@ RUN go install -v ./cmd/${cmd} # Start fresh from a smaller image FROM alpine:3 -ARG cmd +ARG cmd=ssl-ref-client COPY --from=build_go /go/bin/${cmd} /app/${cmd} USER 1000 ENV COMMAND="/app/${cmd}"