From e5cff6b8bb9dcce847ab928f2700a892cb167be1 Mon Sep 17 00:00:00 2001 From: Piero Nicolli Date: Wed, 25 Jan 2023 14:57:58 +0100 Subject: [PATCH] ci: docker build configuration --- .github/workflows/main.yml | 15 ++++++++++----- Dockerfile | 5 ----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 124cc11d8..99790823c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,15 +1,16 @@ name: Docker build for latest main version on: release: - types: [published] + types: [released] jobs: build_main: runs-on: ubuntu-latest steps: - - name: pull request - if: github.event_name == 'release' && github.event.action == 'published' || github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true - uses: actions/checkout@v3 + # - name: pull request + # if: github.event_name == 'release' && github.event.action == 'published' || github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true + # uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -20,6 +21,10 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + - name: Build and push Docker images uses: docker/build-push-action@v3 with: @@ -40,5 +45,5 @@ jobs: project-id: ${{ secrets.RANCHER_PROJECT_ID }} namespace: ${{ secrets.RANCHER_NAMESPACE }} workload: ${{ secrets.RANCHER_WORKLOAD }} - image: redturtletech/io-comune-base:main + image: redturtletech/io-comune-base:${{ steps.get_version.outputs.VERSION }} slack-hook-url: ${{ secrets.RANCHER_SLACK_HOOK_URL }} diff --git a/Dockerfile b/Dockerfile index 9843b171a..46fb79aa3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,6 @@ FROM base as build WORKDIR /home/node/app USER root -ENV RAZZLE_API_PATH=VOLTO_API_PATH -ENV RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH - #RUN buildDeps="build-essential ca-certificates git-core openssl" && \ RUN buildDeps="make" && \ apt-get update && \ @@ -16,7 +13,6 @@ RUN buildDeps="make" && \ COPY . . RUN --mount=type=cache,target=/root/.yarn \ - yarn set version 3.2.3 && \ YARN_CACHE_FOLDER=/root/.yarn yarn --immutable && \ YARN_CACHE_FOLDER=/root/.yarn yarn build && \ rm -rf /home/node/.cache @@ -31,6 +27,5 @@ WORKDIR /home/node/app COPY --chown=node --from=build /home/node/app /home/node/app EXPOSE 3000 3001 4000 4001 -ENTRYPOINT ["/home/node/app/entrypoint.sh"] CMD ["yarn", "start:prod"]