Skip to content

Commit

Permalink
ci: docker build configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pnicolli committed Jan 25, 2023
1 parent 850d9f6 commit e5cff6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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 }}
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand All @@ -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
Expand All @@ -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"]

0 comments on commit e5cff6b

Please sign in to comment.