Skip to content

Commit

Permalink
feat(init): Initialisation de strapi par défaut avec docker
Browse files Browse the repository at this point in the history
Ajout d'un Dockerfile pour le strapi et du docker-compose pour lancer le projet
  • Loading branch information
LiquidITGuy committed Dec 7, 2022
0 parents commit 9cb0223
Show file tree
Hide file tree
Showing 26 changed files with 23,648 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{package.json,*.yml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
15 changes: 15 additions & 0 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOST=0.0.0.0
PORT=1337
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
JWT_SECRET=tobemodified
DATABASE_HOST=1j1s-main-content-manager-db
DATABASE_PORT=5432
DATABASE_NAME=cms-principal
DATABASE_USERNAME=database-user
DATABASE_PASSWORD=database-password
SENTRY_DSN=https://sentryDSN
STRAPI_TELEMETRY_DISABLED=true
PLUGIN_MEILISEARCH_URL=http://localhost:7700
PLUGIN_MEILISEARCH_API_KEY=masterKey
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
HOST=0.0.0.0
PORT=1337
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
JWT_SECRET=tobemodified
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5432
DATABASE_NAME=cms-principal
DATABASE_USERNAME=database-user
DATABASE_PASSWORD=database-password
DATABASE_SSL=false
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
############################
# OS X
############################

.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*


############################
# Linux
############################

*~


############################
# Windows
############################

Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp


############################
# Packages
############################

*.7z
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.com
*.class
*.dll
*.exe
*.o
*.seed
*.so
*.swo
*.swp
*.swn
*.swm
*.out
*.pid


############################
# Logs and databases
############################

.tmp
*.log
*.sql
*.sqlite
*.sqlite3


############################
# Misc.
############################

*#
ssl
.idea
nbproject
public/uploads/*
!public/uploads/.gitkeep

############################
# Node.js
############################

lib-cov
lcov.info
pids
logs
results
node_modules
.node_history

############################
# Tests
############################

testApp
coverage

############################
# Strapi
############################

.env
license.txt
exports
*.cache
dist
build
.strapi-updater.json
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
WORKDIR /opt/
COPY ./package.json ./package-lock.json ./
ENV PATH /opt/node_modules/.bin:$PATH
# Install is used instead of ci because of the difference between arm and x64 processor architecture used by developpers in the project
RUN npm ci
# RUN npm install
WORKDIR /opt/app
COPY ./ .
RUN npm run build
CMD ["npm", "run", "develop"]
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 🚀 Getting started with Strapi

Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html) (CLI) which lets you scaffold and manage your project in seconds.

### `develop`

Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-develop)

```
npm run develop
# or
yarn develop
```

### `start`

Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-start)

```
npm run start
# or
yarn start
```

### `build`

Build your admin panel. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-build)

```
npm run build
# or
yarn build
```

## ⚙️ Deployment

Strapi gives you many possible deployment options for your project. Find the one that suits you on the [deployment section of the documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment.html).

## 📚 Learn more

- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
- [Strapi blog](https://docs.strapi.io) - Official Strapi blog containing articles made by the Strapi team and the community.
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.

Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!

## ✨ Community

- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
- [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.

---

<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>
8 changes: 8 additions & 0 deletions config/admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default ({ env }) => ({
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
apiToken: {
salt: env('API_TOKEN_SALT'),
},
});
7 changes: 7 additions & 0 deletions config/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
rest: {
defaultLimit: 25,
maxLimit: 100,
withCount: true,
},
};
13 changes: 13 additions & 0 deletions config/database.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: env('DATABASE_HOST', '127.0.0.1'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'cms-principal'),
user: env('DATABASE_USERNAME', 'database-user'),
password: env('DATABASE_PASSWORD', 'database-password'),
ssl: env.bool('DATABASE_SSL', false),
},
},
});
12 changes: 12 additions & 0 deletions config/middlewares.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default [
'strapi::errors',
'strapi::security',
'strapi::cors',
'strapi::poweredBy',
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
];
7 changes: 7 additions & 0 deletions config/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
app: {
keys: env.array('APP_KEYS'),
},
});
Empty file added database/migrations/.gitkeep
Empty file.
61 changes: 61 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: '3'
services:
strapi:
container_name: strapi
build: .
restart: unless-stopped
env_file: .env.docker
volumes:
- ./config:/opt/app/config
- ./src:/opt/app/src
- ./package.json:/opt/package.json
- ./package-lock.json:/opt/package-lock.json
- ./public/uploads:/opt/app/public/uploads
ports:
- 80:1337
environment:
DATABASE_SSL: false
depends_on:
- db
networks:
- meilisearch
- database
- strapi
db:
image: postgres
container_name: ${DATABASE_HOST}
restart: always
volumes:
- strapi-data:/var/lib/postgresql/data/
environment:
POSTGRES_DB: ${DATABASE_NAME}
POSTGRES_USER: ${DATABASE_USERNAME}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
networks:
- database
meilisearch:
container_name: 1j1s-meilisearch
image: getmeili/meilisearch:v0.30.0
environment:
- MEILI_MASTER_KEY=${PLUGIN_MEILISEARCH_API_KEY:-masterKey}
- MEILI_NO_ANALYTICS=${MEILI_NO_ANALYTICS:-true}
- MEILI_ENV=${MEILI_ENV:-development}
- MEILI_LOG_LEVEL=${MEILI_LOG_LEVEL:-trace}
- MEILI_DB_PATH=${MEILI_DB_PATH:-/data.ms}
- STRAPI_TELEMETRY_DISABLED=true
networks:
- meilisearch
volumes:
- meilisearch-data:/data.ms
ports:
- 7700:7700
restart: unless-stopped
networks:
strapi:
driver: bridge
database:
internal: true
meilisearch:
volumes:
strapi-data:
meilisearch-data:
Binary file added favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9cb0223

Please sign in to comment.