Skip to content

Commit ad3a355

Browse files
author
Levi Sørum
committed
Create minimalistic Strapi
0 parents  commit ad3a355

File tree

47 files changed

+24391
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+24391
-0
lines changed

.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.git
2+
.tmp
3+
.env
4+
.env.*
5+
!.env.example
6+
node_modules
7+
dist
8+
build
9+
.strapi
10+
.strapi-updater.json
11+
.strapi-cloud.json
12+
public/uploads
13+
*.log

.env.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
HOST=0.0.0.0
2+
PORT=1337
3+
APP_KEYS="toBeModified1,toBeModified2"
4+
API_TOKEN_SALT=tobemodified
5+
ADMIN_JWT_SECRET=tobemodified
6+
TRANSFER_TOKEN_SALT=tobemodified
7+
JWT_SECRET=tobemodified
8+
ENCRYPTION_KEY=tobemodified
9+
10+
# S3 upload provider
11+
S3_ACCESS_KEY_ID=
12+
S3_SECRET_ACCESS_KEY=
13+
S3_ENDPOINT=https://hel1.your-objectstorage.com
14+
S3_REGION=hel1
15+
S3_BUCKET=balve-strapi
16+
S3_CDN_URL=https://balve-strapi.hel1.your-objectstorage.com

.github/workflows/build.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build and push
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
env:
8+
IMAGE: ghcr.io/garmeres/balve-strapi
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- uses: docker/build-push-action@v6
27+
with:
28+
context: .
29+
push: true
30+
tags: |
31+
${{ env.IMAGE }}:latest
32+
${{ env.IMAGE }}:${{ github.sha }}

.gitignore

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
############################
2+
# OS X
3+
############################
4+
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
Icon
9+
.Spotlight-V100
10+
.Trashes
11+
._*
12+
13+
14+
############################
15+
# Linux
16+
############################
17+
18+
*~
19+
20+
21+
############################
22+
# Windows
23+
############################
24+
25+
Thumbs.db
26+
ehthumbs.db
27+
Desktop.ini
28+
$RECYCLE.BIN/
29+
*.cab
30+
*.msi
31+
*.msm
32+
*.msp
33+
34+
35+
############################
36+
# Packages
37+
############################
38+
39+
*.7z
40+
*.csv
41+
*.dat
42+
*.dmg
43+
*.gz
44+
*.iso
45+
*.jar
46+
*.rar
47+
*.tar
48+
*.zip
49+
*.com
50+
*.class
51+
*.dll
52+
*.exe
53+
*.o
54+
*.seed
55+
*.so
56+
*.swo
57+
*.swp
58+
*.swn
59+
*.swm
60+
*.out
61+
*.pid
62+
63+
64+
############################
65+
# Logs and databases
66+
############################
67+
68+
.tmp
69+
*.log
70+
*.sql
71+
*.sqlite
72+
*.sqlite3
73+
74+
75+
############################
76+
# Misc.
77+
############################
78+
79+
*#
80+
ssl
81+
.idea
82+
nbproject
83+
public/uploads/*
84+
!public/uploads/.gitkeep
85+
.tsbuildinfo
86+
.eslintcache
87+
88+
############################
89+
# Node.js
90+
############################
91+
92+
lib-cov
93+
lcov.info
94+
pids
95+
logs
96+
results
97+
node_modules
98+
.node_history
99+
100+
############################
101+
# Package managers
102+
############################
103+
104+
.yarn/*
105+
!.yarn/cache
106+
!.yarn/unplugged
107+
!.yarn/patches
108+
!.yarn/releases
109+
!.yarn/sdks
110+
!.yarn/versions
111+
.pnp.*
112+
yarn-error.log
113+
114+
############################
115+
# Tests
116+
############################
117+
118+
coverage
119+
120+
############################
121+
# Strapi
122+
############################
123+
124+
.env
125+
license.txt
126+
exports
127+
.strapi
128+
dist
129+
build
130+
.strapi-updater.json
131+
.strapi-cloud.json
132+
node_modules

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM node:20-alpine AS build
2+
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json ./
6+
RUN npm ci
7+
8+
COPY . .
9+
RUN npm run build
10+
11+
FROM node:20-alpine
12+
13+
WORKDIR /app
14+
15+
COPY package.json package-lock.json ./
16+
RUN npm ci --omit=dev
17+
18+
COPY --from=build /app/dist ./dist
19+
COPY --from=build /app/config ./config
20+
COPY ./public ./public
21+
COPY favicon.png ./
22+
23+
RUN mkdir -p /data
24+
25+
EXPOSE 1337
26+
27+
CMD ["npm", "run", "start"]

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# 🚀 Getting started with Strapi
2+
3+
Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/dev-docs/cli) (CLI) which lets you scaffold and manage your project in seconds.
4+
5+
### `develop`
6+
7+
Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-develop)
8+
9+
```
10+
npm run develop
11+
# or
12+
yarn develop
13+
```
14+
15+
### `start`
16+
17+
Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-start)
18+
19+
```
20+
npm run start
21+
# or
22+
yarn start
23+
```
24+
25+
### `build`
26+
27+
Build your admin panel. [Learn more](https://docs.strapi.io/dev-docs/cli#strapi-build)
28+
29+
```
30+
npm run build
31+
# or
32+
yarn build
33+
```
34+
35+
## ⚙️ Deployment
36+
37+
Strapi gives you many possible deployment options for your project including [Strapi Cloud](https://cloud.strapi.io). Browse the [deployment section of the documentation](https://docs.strapi.io/dev-docs/deployment) to find the best solution for your use case.
38+
39+
```
40+
yarn strapi deploy
41+
```
42+
43+
## 📚 Learn more
44+
45+
- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
46+
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
47+
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
48+
- [Strapi blog](https://strapi.io/blog) - Official Strapi blog containing articles made by the Strapi team and the community.
49+
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
50+
51+
Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
52+
53+
## ✨ Community
54+
55+
- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
56+
- [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.
57+
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
58+
59+
---
60+
61+
<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>

config/admin.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { Core } from '@strapi/strapi';
2+
3+
const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Admin => ({
4+
auth: {
5+
secret: env('ADMIN_JWT_SECRET'),
6+
},
7+
apiToken: {
8+
salt: env('API_TOKEN_SALT'),
9+
},
10+
transfer: {
11+
token: {
12+
salt: env('TRANSFER_TOKEN_SALT'),
13+
},
14+
},
15+
secrets: {
16+
encryptionKey: env('ENCRYPTION_KEY'),
17+
},
18+
flags: {
19+
nps: env.bool('FLAG_NPS', true),
20+
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
21+
},
22+
});
23+
24+
export default config;

config/api.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Core } from '@strapi/strapi';
2+
3+
const config: Core.Config.Api = {
4+
rest: {
5+
defaultLimit: 25,
6+
maxLimit: 100,
7+
withCount: true,
8+
},
9+
};
10+
11+
export default config;

config/database.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import path from 'path';
2+
import type { Core } from '@strapi/strapi';
3+
4+
const config = ({ env }: Core.Config.Shared.ConfigParams): Core.Config.Database => {
5+
const client = env('DATABASE_CLIENT', 'sqlite');
6+
7+
const connections = {
8+
mysql: {
9+
connection: {
10+
host: env('DATABASE_HOST', 'localhost'),
11+
port: env.int('DATABASE_PORT', 3306),
12+
database: env('DATABASE_NAME', 'strapi'),
13+
user: env('DATABASE_USERNAME', 'strapi'),
14+
password: env('DATABASE_PASSWORD', 'strapi'),
15+
ssl: env.bool('DATABASE_SSL', false) && {
16+
key: env('DATABASE_SSL_KEY', undefined),
17+
cert: env('DATABASE_SSL_CERT', undefined),
18+
ca: env('DATABASE_SSL_CA', undefined),
19+
capath: env('DATABASE_SSL_CAPATH', undefined),
20+
cipher: env('DATABASE_SSL_CIPHER', undefined),
21+
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
22+
},
23+
},
24+
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
25+
},
26+
postgres: {
27+
connection: {
28+
connectionString: env('DATABASE_URL'),
29+
host: env('DATABASE_HOST', 'localhost'),
30+
port: env.int('DATABASE_PORT', 5432),
31+
database: env('DATABASE_NAME', 'strapi'),
32+
user: env('DATABASE_USERNAME', 'strapi'),
33+
password: env('DATABASE_PASSWORD', 'strapi'),
34+
ssl: env.bool('DATABASE_SSL', false) && {
35+
key: env('DATABASE_SSL_KEY', undefined),
36+
cert: env('DATABASE_SSL_CERT', undefined),
37+
ca: env('DATABASE_SSL_CA', undefined),
38+
capath: env('DATABASE_SSL_CAPATH', undefined),
39+
cipher: env('DATABASE_SSL_CIPHER', undefined),
40+
rejectUnauthorized: env.bool('DATABASE_SSL_REJECT_UNAUTHORIZED', true),
41+
},
42+
schema: env('DATABASE_SCHEMA', 'public'),
43+
},
44+
pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
45+
},
46+
sqlite: {
47+
connection: {
48+
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
49+
},
50+
useNullAsDefault: true,
51+
},
52+
};
53+
54+
return {
55+
connection: {
56+
client,
57+
...connections[client],
58+
acquireConnectionTimeout: env.int('DATABASE_CONNECTION_TIMEOUT', 60000),
59+
},
60+
};
61+
};
62+
63+
export default config;

0 commit comments

Comments
 (0)