From b0d037ca3593174f5689895f52ed3a5699bae6e7 Mon Sep 17 00:00:00 2001 From: Olivier Filangi Date: Fri, 9 Jul 2021 09:59:46 +0200 Subject: [PATCH 1/4] 1.0.0 --- .circleci/config.yml | 75 ++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 16 ++++++++++ 2 files changed, 91 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..a480ccb --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,75 @@ +# +# ofilangi +# +# DOCKER_CONTEXT is a context global env variable for all application github p2m2 organization +# - DOCKER_USER -> login +# - DOCKER_PASS -> password +# - ORGANIZATION_NAME -> organization register on dockerhub +# +version: 2.1 +workflows: + docker-publication-workflow: + jobs: + # only develop is build and push on dockerhub ! + - build_branch: + context: + - DOCKER_CONTEXT + filters: + tags: + ignore: /.*/ + branches: + only: + - develop + + # all tags are build and push on dockerhub ! + - build_tag_latest: + context: + - DOCKER_CONTEXT + filters: + tags: + only: /.*/ + branches: + # nothing coming from branch are deployed as latest + ignore: /.*/ + +executors: + docker-publisher: + docker: + - image: circleci/buildpack-deps:stretch + auth: + username: ${DOCKER_USER} + password: ${DOCKER_PASS} + +jobs: + build_branch: + executor: docker-publisher + steps: + - checkout + - setup_remote_docker + - run: + name: Publish Docker Image to Docker Hub + # publication of : + command: | + IMAGE_NAME=${CIRCLE_PROJECT_REPONAME}:${CIRCLE_BRANCH} + + docker build -t ${ORGANIZATION_NAME}/${IMAGE_NAME} . + echo ${DOCKER_PASS} | docker login -u ${DOCKER_USER} --password-stdin + docker push ${ORGANIZATION_NAME}/${IMAGE_NAME} + build_tag_latest: + executor: docker-publisher + steps: + - checkout + - setup_remote_docker + - run: + name: Publish Docker Tag to Docker Hub + # publication of : + command: | + IMAGE_NAME=${CIRCLE_PROJECT_REPONAME}:${CIRCLE_TAG} + IMAGE_NAME_LATEST=${CIRCLE_PROJECT_REPONAME}:latest + + docker build -t ${ORGANIZATION_NAME}/${IMAGE_NAME} . + docker build -t ${ORGANIZATION_NAME}/${IMAGE_NAME_LATEST} . + + echo ${DOCKER_PASS} | docker login -u ${DOCKER_USER} --password-stdin + docker push ${ORGANIZATION_NAME}/${IMAGE_NAME} + docker push ${ORGANIZATION_NAME}/${IMAGE_NAME_LATEST} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..add6a10 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM adoptopenjdk:latest + +RUN apt-get update && apt-get install -y gnupg + +RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list +RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list +RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add + +RUN apt-get update && apt-get install -y sbt + +WORKDIR /workdir +RUN sbt version +WORKDIR / + + + From 9b444cc40b6fff4861b31bee75b93ee7dc38225b Mon Sep 17 00:00:00 2001 From: Olivier Filangi Date: Fri, 9 Jul 2021 10:02:30 +0200 Subject: [PATCH 2/4] display version. force download --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index add6a10..73ecc1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E4 RUN apt-get update && apt-get install -y sbt WORKDIR /workdir -RUN sbt version +RUN sbt --verbose --version WORKDIR / From 905ac7eef1bdd8d1829211b8f2ca12461fe47959 Mon Sep 17 00:00:00 2001 From: Olivier Filangi Date: Fri, 9 Jul 2021 10:03:36 +0200 Subject: [PATCH 3/4] Add .circleci/config.yml From 504606a3c982977b59152d956373ce2906270da5 Mon Sep 17 00:00:00 2001 From: Olivier Filangi Date: Fri, 9 Jul 2021 10:08:51 +0200 Subject: [PATCH 4/4] update readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 221d014..9b0e006 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # image-scala-sbt Docker image scala-sbt + +```Dockerfile +FROM inraep2m2/image-scala-sbt:latest +```