Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy with docker #218

Merged
merged 4 commits into from
May 31, 2024
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN npm run build
FROM node:20
WORKDIR /app
COPY package*.json ./
RUN npm pkg set scripts.prepare='true' && npm ci --only=production
RUN npm pkg set scripts.prepare='true' && npm ci --omit=dev
COPY --from=build /src/dist /app/dist
EXPOSE 3333
CMD [ "npm", "run", "prod" ]
25 changes: 17 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
version: '3'
services:
mysql:
image: 'mysql:8.2.0'
#mysql:
# image: 'mysql:8.2.0'
# ports:
# - '3306:3306'
# environment:
# MYSQL_ROOT_PASSWORD: 'admin'
# MYSQL_USER: 'test'
# MYSQL_PASSWORD: 'test'
# MYSQL_DATABASE: 'test'
api:
build: .
container_name: api
ports:
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: 'admin'
MYSQL_USER: 'test'
MYSQL_PASSWORD: 'test'
MYSQL_DATABASE: 'test'
- "3333:3333"
volumes:
- ./serverless_express_template.db:/app/serverless_express_template.db
#depends_on:
# - mysql
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "serverless-express-template",
"version": "0.0.1",
"templateVersion": "1.6.0",
"templateVersion": "1.7.1",
"description": "A template for serverless-express",
"main": "./lambda.js",
"type": "commonjs",
Expand Down Expand Up @@ -64,6 +64,7 @@
"compression": "1.7.4",
"config": "3.3.11",
"cors": "2.8.5",
"cross-env": "7.0.3",
"dayjs": "1.11.11",
"dotenv": "16.3.1",
"ejs": "3.1.10",
Expand Down Expand Up @@ -109,7 +110,6 @@
"babel-plugin-transform-typescript-metadata": "0.3.2",
"commitizen": "4.3.0",
"commitizen-emoji": "1.0.5",
"cross-env": "7.0.3",
"cross-var": "1.1.0",
"eslint": "8.57.0",
"eslint-config-airbnb-base": "15.0.0",
Expand Down
Binary file modified serverless_express_template.db
Binary file not shown.
4 changes: 3 additions & 1 deletion src/database/sources/production.source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const productionDataSource = new DataSource({
},
logging: false,
entities: [`${path.resolve(__dirname, '..', '..')}/entities/*.{js,ts}`],
migrations: [`${path.resolve(__dirname, '..')}/migrations/migrations-*.{js,ts}`],
migrations: [
`${path.resolve(__dirname, '..')}/migrations/*-migrations.{js,ts}`,
],
subscribers: [],
});

Expand Down
Loading