Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cliamrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module.exports = {
transporters: [
{
id: 'smtp-transporter',
mode: 'smtp',
auth: {
username: "[email protected]",
password: "5cDumYP68aFcpT15uV"
Expand Down
4 changes: 2 additions & 2 deletions src/env/template.env → .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ REFRESH_TOKEN_SECRET = "hello-i-am-a-refresh-token-secret-passphrase"
# SSL_KEY = "path-to-my-ssl-key.pem"

# Database engine
TYPEORM_TYPE = "mysql"
TYPEORM_TYPE = "mariadb"

# Database connection identifier
# TYPEORM_NAME = "default"

# Database server host
# Database server host. Use "db" with docker-compose, localhost otherwise.
TYPEORM_HOST = "localhost"

# Database name. Keep it different from your developement database.
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.9.0'
- name: Create directories
run: mkdir -p ./dist/env && cp ./src/env/template.env ./dist/env/test.env
- name: Setup .env file
run: |
echo FACEBOOK_CONSUMER_ID = "${{ secrets.FACEBOOK_CONSUMER_ID }}" >> ./dist/env/test.env
echo FACEBOOK_CONSUMER_SECRET = "${{ secrets.FACEBOOK_CONSUMER_SECRET }}" >> ./dist/env/test.env
echo GITHUB_CONSUMER_ID = "${{ secrets.GTHB_CONSUMER_ID }}" >> ./dist/env/test.env
echo GITHUB_CONSUMER_SECRET = "${{ secrets.GTHB_CONSUMER_SECRET }}" >> ./dist/env/test.env
echo GOOGLE_CONSUMER_ID = "${{ secrets.GOOGLE_CONSUMER_ID }}" >> ./dist/env/test.env
echo GOOGLE_CONSUMER_SECRET = "${{ secrets.GOOGLE_CONSUMER_SECRET }}" >> ./dist/env/test.env
echo LINKEDIN_CONSUMER_ID = "${{ secrets.LINKEDIN_CONSUMER_ID }}" >> ./dist/env/test.env
echo LINKEDIN_CONSUMER_SECRET = "${{ secrets.LINKEDIN_CONSUMER_SECRET }}" >> ./dist/env/test.env
- name: Install global dependencies
run: npm i [email protected] -g
- name: Install local dependencies
Expand Down Expand Up @@ -60,11 +48,23 @@ jobs:
with:
mysql version: '5.7'
mysql database: 'typeplate_test'
mysql root password: passw0rd
mysql root password: passw0rd
- name: Install global dependencies
run: npm i [email protected] -g
- name: Install local dependencies
run: npm i
- name: Copy .env.example to .env.test
run: cp .env.example .env.test
- name: Setup .env file
run: |
echo FACEBOOK_CONSUMER_ID = "${{ secrets.FACEBOOK_CONSUMER_ID }}" >> .env.test
echo FACEBOOK_CONSUMER_SECRET = "${{ secrets.FACEBOOK_CONSUMER_SECRET }}" >> .env.test
echo GITHUB_CONSUMER_ID = "${{ secrets.GTHB_CONSUMER_ID }}" >> .env.test
echo GITHUB_CONSUMER_SECRET = "${{ secrets.GTHB_CONSUMER_SECRET }}" >> .env.test
echo GOOGLE_CONSUMER_ID = "${{ secrets.GOOGLE_CONSUMER_ID }}" >> .env.test
echo GOOGLE_CONSUMER_SECRET = "${{ secrets.GOOGLE_CONSUMER_SECRET }}" >> .env.test
echo LINKEDIN_CONSUMER_ID = "${{ secrets.LINKEDIN_CONSUMER_ID }}" >> .env.test
echo LINKEDIN_CONSUMER_SECRET = "${{ secrets.LINKEDIN_CONSUMER_SECRET }}" >> .env.test
- name: Create dist directory
run: mkdir dist
- name: Download build artifact
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.9.0'
- name: Create directories
run: mkdir -p ./dist/env && cp ./src/env/template.env ./dist/env/test.env
- name: Setup .env file
run: |
echo FACEBOOK_CONSUMER_ID = "${{ secrets.FACEBOOK_CONSUMER_ID }}" >> ./dist/env/test.env
echo FACEBOOK_CONSUMER_SECRET = "${{ secrets.FACEBOOK_CONSUMER_SECRET }}" >> ./dist/env/test.env
echo GITHUB_CONSUMER_ID = "${{ secrets.GTHB_CONSUMER_ID }}" >> ./dist/env/test.env
echo GITHUB_CONSUMER_SECRET = "${{ secrets.GTHB_CONSUMER_SECRET }}" >> ./dist/env/test.env
echo GOOGLE_CONSUMER_ID = "${{ secrets.GOOGLE_CONSUMER_ID }}" >> ./dist/env/test.env
echo GOOGLE_CONSUMER_SECRET = "${{ secrets.GOOGLE_CONSUMER_SECRET }}" >> ./dist/env/test.env
echo LINKEDIN_CONSUMER_ID = "${{ secrets.LINKEDIN_CONSUMER_ID }}" >> ./dist/env/test.env
echo LINKEDIN_CONSUMER_SECRET = "${{ secrets.LINKEDIN_CONSUMER_SECRET }}" >> ./dist/env/test.env
- name: Install global dependencies
run: npm i [email protected] -g
- name: Install local dependencies
Expand Down Expand Up @@ -61,11 +49,23 @@ jobs:
with:
mysql version: '5.7'
mysql database: 'typeplate_test'
mysql root password: passw0rd
mysql root password: passw0rd
- name: Install global dependencies
run: npm i [email protected] -g
- name: Install local dependencies
run: npm i
- name: Copy .env.example to .env.test
run: cp .env.example .env.test
- name: Setup .env file
run: |
echo FACEBOOK_CONSUMER_ID = "${{ secrets.FACEBOOK_CONSUMER_ID }}" >> .env.test
echo FACEBOOK_CONSUMER_SECRET = "${{ secrets.FACEBOOK_CONSUMER_SECRET }}" >> .env.test
echo GITHUB_CONSUMER_ID = "${{ secrets.GTHB_CONSUMER_ID }}" >> .env.test
echo GITHUB_CONSUMER_SECRET = "${{ secrets.GTHB_CONSUMER_SECRET }}" >> .env.test
echo GOOGLE_CONSUMER_ID = "${{ secrets.GOOGLE_CONSUMER_ID }}" >> .env.test
echo GOOGLE_CONSUMER_SECRET = "${{ secrets.GOOGLE_CONSUMER_SECRET }}" >> .env.test
echo LINKEDIN_CONSUMER_ID = "${{ secrets.LINKEDIN_CONSUMER_ID }}" >> .env.test
echo LINKEDIN_CONSUMER_SECRET = "${{ secrets.LINKEDIN_CONSUMER_SECRET }}" >> .env.test
- name: Create dist directory
run: mkdir dist
- name: Download build artifact
Expand All @@ -77,7 +77,7 @@ jobs:
run: npm run schema:sync
- name: Execute tests suites
run: npm run ci:test
- name: Publish to coveralls.io
- name: Publish coverage to coveralls.io
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ docs/
reports/

# .env files
/**/env/development.env
/**/env/production.env
/**/env/staging.env
/**/env/test.env
.env.development
.env.test
.env.staging
.env.production

# Husky configuration
.husky/
Expand Down
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Build stage
FROM node:20.18.0-alpine AS builder

WORKDIR /app

# Install build dependencies
COPY package*.json ./
RUN npm ci

# Copy source code
COPY . .

# Build TypeScript code and create env files
RUN npm run init:copy && npm run init:compile

# Production stage
FROM node:20.18.0-alpine AS production

WORKDIR /app

# Install production dependencies only
COPY package*.json ./
RUN npm i
RUN npm i -g nodemon

# Copy built files and config files
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/.cliamrc.js ./.cliamrc.js

# Create necessary directories for uploads and logs
RUN mkdir -p ./dist/public/archives \
&& mkdir -p ./dist/public/documents \
&& mkdir -p ./dist/public/images/master-copy \
&& mkdir -p ./dist/public/images/rescale \
&& mkdir -p ./dist/public/audios \
&& mkdir -p ./dist/public/videos \
&& mkdir -p ./dist/logs

# Set environment variables
ENV NODE_ENV=development
ENV PORT=8101

# Expose the port
EXPOSE 8101

# Start the application
CMD ["nodemon", "."]
46 changes: 46 additions & 0 deletions Dockerfile.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build stage
FROM node:20.18.0-alpine AS builder

WORKDIR /app

# Install build dependencies
COPY package*.json ./
RUN npm ci

# Copy source code
COPY . .

# Build TypeScript code and create env files
RUN npm run init:copy && npm run init:compile

# Production stage
FROM node:20.18.0-alpine AS production

WORKDIR /app

# Install production dependencies only
COPY package*.json ./
RUN npm ci --only=production

# Copy built files and config files
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/.cliamrc.js ./.cliamrc.js

# Create necessary directories for uploads and logs
RUN mkdir -p ./dist/public/archives \
&& mkdir -p ./dist/public/documents \
&& mkdir -p ./dist/public/images/master-copy \
&& mkdir -p ./dist/public/images/rescale \
&& mkdir -p ./dist/public/audios \
&& mkdir -p ./dist/public/videos \
&& mkdir -p ./dist/logs

# Set environment variables
ENV NODE_ENV=production
ENV PORT=8101

# Expose the port
EXPOSE 8101

# Start the application
CMD ["node", "./dist/api/app.bootstrap.js"]
Loading
Loading