generated from idea2app/Strapi-PNPM-Docker-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c503b3d
Showing
35 changed files
with
13,513 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
README.md | ||
*.example | ||
node_modules/ | ||
.editorconfig | ||
.eslintrc.json | ||
Dockerfile | ||
docker-compose.yml | ||
start.sh | ||
.husky/ | ||
.git/ | ||
.husky/ | ||
.github/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
HOST=0.0.0.0 | ||
PORT=1337 | ||
APP_KEYS="toBeModified1,toBeModified2" | ||
API_TOKEN_SALT=tobemodified | ||
ADMIN_JWT_SECRET=tobemodified | ||
TRANSFER_TOKEN_SALT=tobemodified | ||
JWT_SECRET=tobemodified | ||
DATABASE_URL=postgres://user:password@host:port/database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# reference: | ||
# 1. https://github.com/docker/build-push-action/blob/master/docs/advanced/push-multi-registries.md | ||
# 2. https://github.com/docker/build-push-action/blob/master/docs/advanced/share-image-jobs.md | ||
|
||
name: Deploy to Production environment | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
env: | ||
ARTIFACT_PATH: artifact.tar | ||
BOX_NAME: strapi-server | ||
BOX_URL: idea2app/strapi-server | ||
|
||
jobs: | ||
deploy_docker_image: | ||
name: Deploy Docker image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Inject Environment variables | ||
run: | | ||
cat > .env <<EOF | ||
${{ secrets.ENV_FILE }} | ||
EOF | ||
- uses: docker/setup-qemu-action@v2 | ||
- uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
tags: ${{ env.BOX_URL }}:latest | ||
outputs: type=docker,dest=${{ env.ARTIFACT_PATH }} | ||
|
||
- name: Pick Docker Compose | ||
run: | | ||
mkdir ./build | ||
mv ${{ env.ARTIFACT_PATH }} ./docker-compose.yml ./start.sh ./build | ||
- name: Transport Image | ||
uses: garygrossgarten/github-action-scp@release | ||
with: | ||
local: ./build | ||
remote: /tmp/${{ env.BOX_NAME }} | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USER }} | ||
password: ${{ secrets.SSH_KEY }} | ||
|
||
- name: Run Image | ||
uses: garygrossgarten/github-action-ssh@release | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USER }} | ||
password: ${{ secrets.SSH_KEY }} | ||
command: | | ||
cd /tmp/${{ env.BOX_NAME }} | ||
mkdir -p ~/${{ env.BOX_NAME }} | ||
mv docker-compose.yml start.sh ~/${{ env.BOX_NAME }} | ||
cd ~/${{ env.BOX_NAME }} | ||
chmod +x start.sh | ||
echo '${{ secrets.SSH_KEY }}' | sudo -S ./start.sh /tmp/${{ env.BOX_NAME }}/${{ env.ARTIFACT_PATH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
############################ | ||
# 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 | ||
############################ | ||
|
||
coverage | ||
|
||
############################ | ||
# Strapi | ||
############################ | ||
|
||
.env | ||
license.txt | ||
exports | ||
*.cache | ||
dist | ||
build | ||
.strapi/ | ||
.strapi-updater.json | ||
documentation/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tasks: | ||
- init: pnpm i | ||
command: pnpm develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
auto-install-peers = false | ||
node-linker = hoisted | ||
shamefully-hoist = true | ||
dedupe-direct-deps = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Reference: https://pnpm.io/docker#example-1-build-a-bundle-in-a-docker-container | ||
|
||
FROM node:18-slim AS base | ||
RUN apt-get update && \ | ||
apt-get install curl -y --no-install-recommends | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
COPY . /app | ||
WORKDIR /app | ||
|
||
FROM base AS prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --prod --frozen-lockfile | ||
|
||
FROM base AS build | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm i --frozen-lockfile | ||
RUN pnpm build | ||
|
||
FROM base | ||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
COPY --from=build /app/dist /app/dist | ||
EXPOSE 1337 | ||
CMD ["npm", "start"] |
Oops, something went wrong.