all repos — caroster @ 68c50e7913a1f063dadf3e3822d4cc0d9c7a91af

[Octree] Group carpool to your event https://caroster.io

chore: :construction_worker: Split in two Docker images
Tim Izzo tim@octree.ch
Wed, 24 Aug 2022 09:44:20 +0200
commit

68c50e7913a1f063dadf3e3822d4cc0d9c7a91af

parent

6d2659c5a5d3df7aeeaad568e6543fcbb943bf45

9 files changed, 78 insertions(+), 58 deletions(-)

jump to
D .dockerignore

@@ -1,15 +0,0 @@

-Dockerfile -.dockerignore -README.md -.gitlab-ci.yml -node_modules - -backend/node_modules -backend/.cache -backend/.tmp -backend/.db -backend/README.md -backend/build - -frontend/node_modules -frontend/.next
M .gitlab-ci.yml.gitlab-ci.yml

@@ -1,7 +1,6 @@

include: - project: o/infra/templates - file: /gitlab-ci/includes/StrapiBuildDeploy.yaml - + file: /gitlab-ci/includes/jobs.yaml Test E2E: stage: test

@@ -23,4 +22,47 @@ - cd backend/

- yarn - cd ../e2e/ - yarn - - yarn test+ - yarn test + +Build NextJS: + extends: .build + variables: + CI_PROJECT_DIR: frontend/ + CI_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/next + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + changes: + - frontend/**/* + +Build Strapi: + extends: .build + variables: + CI_PROJECT_DIR: backend/ + CI_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/strapi + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + changes: + - backend/**/* + +Deploy NextJS to Test: + extends: .deployJelasticNode + needs: ["Build NextJS"] + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $ENVNAME && $NODE_ID_NEXT + changes: + - frontend/**/* + variables: + NODE_ID: $NODE_ID_NEXT + environment: + name: Test + url: "https://$ENVNAME.hidora.com" + +Deploy Strapi to Test: + extends: .deployJelasticNode + needs: ["Build Strapi"] + variables: + NODE_ID: $NODE_ID_STRAPI + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $ENVNAME && $NODE_ID_STRAPI + changes: + - backend/**/*
D Dockerfile

@@ -1,2 +0,0 @@

-FROM git.octree.ch:4567/o/infra/templates/base/strapi:pm2-14 -COPY . /srv/app
D README.md

@@ -1,6 +0,0 @@

-# Strapi application - -A quick description of your strapi application - -### Wireframes -[Whimsical](https://whimsical.com/5zXVZQvPAQokSVLgxQHhMm)
A backend/.dockerignore

@@ -0,0 +1,7 @@

+node_modules/ +.cache +.tmp +build +.env +Dockerfile +.dockerignore
A backend/Dockerfile

@@ -0,0 +1,11 @@

+FROM node:14-alpine + +WORKDIR /srv/app +COPY ./ . + +EXPOSE 1337 +VOLUME /srv/app/public/uploads +VOLUME /srv/app/node_modules +VOLUME /srv/app/build + +CMD ["yarn", "start"]
D ecosystem.config.js

@@ -1,32 +0,0 @@

-const { HOST = "localhost" } = process.env; - -module.exports = { - apps: [ - { - name: "strapi", - cwd: "backend/", - script: "yarn", - args: "start", - interpreter: "bash", - restart_delay: 10000, - max_restarts: 10, - env: { - PORT: 80, - STRAPI_LOG_LEVEL: "info", - STRAPI_LOG_FORCE_COLOR: false, - }, - }, - { - name: "next", - cwd: "frontend/", - script: "yarn", - args: "start", - interpreter: "bash", - restart_delay: 10000, - env: { - PORT: 3000, - STRAPI_URL: `http://${HOST}`, - }, - }, - ], -};
A frontend/.dockerignore

@@ -0,0 +1,4 @@

+node_modules +.next +Dockerfile +.dockerignore
A frontend/Dockerfile

@@ -0,0 +1,11 @@

+FROM node:16-alpine + +WORKDIR /srv/app + +COPY . . + +EXPOSE 3000 +VOLUME /srv/app/node_modules +VOLUME /srv/app/.next + +CMD ["yarn", "start"]