Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 279eb59

Browse files
authored
Merge pull request #3 from vim/feature/initialize-webpage-and-cms
Feature/initialize webpage and cms
2 parents d050270 + 54281a3 commit 279eb59

Some content is hidden

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

56 files changed

+19502
-0
lines changed

.development.docker-compose.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
version: "3"
2+
services:
3+
app:
4+
container_name: app
5+
environment:
6+
- CMS_API=http://cms:1337/api
7+
build:
8+
context: ./app
9+
dockerfile: Dockerfile
10+
volumes:
11+
- ./app/src/app:/opt/app/src/app
12+
ports:
13+
- 3000:3000
14+
networks:
15+
- vim_network
16+
17+
db:
18+
container_name: db
19+
restart: unless-stopped
20+
image: mysql:8
21+
environment:
22+
- MYSQL_ROOT_PASSWORD=${DATABASE_PASSWORD}
23+
- MYSQL_USER=${DATABASE_USERNAME}
24+
- MYSQL_PASSWORD=${DATABASE_PASSWORD}
25+
- MYSQL_DATABASE=${CMS_DATABASE_NAME}
26+
volumes:
27+
- vim-cms-data:/var/lib/mysql
28+
- ./db/docker-scripts:/docker-entrypoint-initdb.d
29+
ports:
30+
- 3306:3306
31+
networks:
32+
- vim_network
33+
34+
cms:
35+
container_name: strapi
36+
build:
37+
context: ./cms
38+
dockerfile: Dockerfile
39+
restart: unless-stopped
40+
env_file: ./cms/.env
41+
environment:
42+
DATABASE_CLIENT: ${DATABASE_CLIENT}
43+
DATABASE_HOST: db
44+
DATABASE_PORT: ${DATABASE_PORT}
45+
DATABASE_NAME: ${CMS_DATABASE_NAME}
46+
DATABASE_USERNAME: ${DATABASE_USERNAME}
47+
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
48+
JWT_SECRET: ${CMS_JWT_SECRET}
49+
ADMIN_JWT_SECRET: ${CMS_ADMIN_JWT_SECRET}
50+
APP_KEYS: ${CMS_APP_KEYS}
51+
NODE_ENV: ${NODE_ENV}
52+
volumes:
53+
- ./cms/config:/opt/app/config
54+
- ./cms/src:/opt/app/src
55+
- ./cms/package.json:/opt/package.json
56+
- ./cms/.env:/opt/app/.env
57+
- ./cms/public/uploads:/opt/app/public/uploads
58+
ports:
59+
- 1337:1337
60+
networks:
61+
- vim_network
62+
depends_on:
63+
- db
64+
65+
volumes:
66+
vim-cms-data:
67+
68+
networks:
69+
vim_network:
70+
name: vim_network
71+
driver: bridge

.env.example

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
DATABASE_CLIENT=mysql2
2+
DATABASE_USERNAME=vim
3+
DATABASE_PASSWORD=super-secret
4+
DATABASE_PORT=3306
5+
DATABASE_SSL=false
6+
7+
APP_DATABASE_NAME=vim
8+
CMS_DATABASE_NAME=vim_cms
9+
10+
CMS_PORT=1337
11+
CMS_APP_KEYS=testkey1,testkey2
12+
CMS_API_TOKEN_SALT=testtoken
13+
CMS_ADMIN_JWT_SECRET=testsecret
14+
CMS_JWT_SECRET=testsecret
15+
CMS_TRANSFER_TOKEN_SALT=testtoken
16+
17+
NODE_ENV=development

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

cms/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
build

cms/.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[{package.json,*.yml}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

cms/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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

cms/.gitignore

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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+
86+
############################
87+
# Node.js
88+
############################
89+
90+
lib-cov
91+
lcov.info
92+
pids
93+
logs
94+
results
95+
node_modules
96+
.node_history
97+
98+
############################
99+
# Tests
100+
############################
101+
102+
coverage
103+
104+
############################
105+
# Strapi
106+
############################
107+
108+
.env
109+
license.txt
110+
exports
111+
*.cache
112+
dist
113+
build
114+
.strapi-updater.json

cms/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.18.2

cms/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:18-alpine
2+
# Installing libvips-dev for sharp Compatibility
3+
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev git
4+
ARG NODE_ENV=development
5+
ENV NODE_ENV=${NODE_ENV}
6+
7+
WORKDIR /opt/
8+
COPY package.json package-lock.json ./
9+
RUN npm install -g node-gyp
10+
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install
11+
ENV PATH /opt/node_modules/.bin:$PATH
12+
13+
WORKDIR /opt/app
14+
COPY . .
15+
RUN chown -R node:node /opt/app
16+
USER node
17+
RUN ["npm", "run", "build"]
18+
EXPOSE 1337
19+
CMD ["npm", "run", "develop"]

cms/Dockerfile.prod

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:18-alpine as build
2+
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
3+
ARG NODE_ENV=production
4+
ENV NODE_ENV=${NODE_ENV}
5+
6+
WORKDIR /opt/
7+
COPY package.json package-lock.json ./
8+
RUN npm install -g node-gyp
9+
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install --only=production
10+
ENV PATH /opt/node_modules/.bin:$PATH
11+
WORKDIR /opt/app
12+
COPY . .
13+
RUN npm run build
14+
15+
FROM node:18-alpine
16+
RUN apk add --no-cache vips-dev
17+
ARG NODE_ENV=production
18+
ENV NODE_ENV=${NODE_ENV}
19+
WORKDIR /opt/
20+
COPY --from=build /opt/node_modules ./node_modules
21+
WORKDIR /opt/app
22+
COPY --from=build /opt/app ./
23+
ENV PATH /opt/node_modules/.bin:$PATH
24+
25+
RUN chown -R node:node /opt/app
26+
USER node
27+
EXPOSE 1337
28+
CMD ["npm", "run", "start"]

0 commit comments

Comments
 (0)