mirror of
https://github.com/sergeyyarkov/educt-server.git
synced 2026-10-11 02:09:07 +03:00
feat: added base docker container
This commit is contained in:
parent
c0aad40853
commit
79e56696fd
@ -1,6 +1,20 @@
|
||||
build
|
||||
# Adonis default .gitignore ignores
|
||||
node_modules
|
||||
.git
|
||||
*.log
|
||||
build
|
||||
uploads
|
||||
coverage
|
||||
.vscode
|
||||
.DS_STORE
|
||||
.env
|
||||
Dockerfile
|
||||
tmp
|
||||
|
||||
# Additional .gitignore ignores (any custom file you wish)
|
||||
.idea
|
||||
|
||||
# Additional good to have ignores for dockerignore
|
||||
Dockerfile*
|
||||
docker-compose*
|
||||
.dockerignore
|
||||
*.md
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
@ -19,8 +19,8 @@ SMTP_PASSWORD=<password>
|
||||
MAILGUN_API_KEY=<mailgun-api-key>
|
||||
MAILGUN_DOMAIN=<your-domain>
|
||||
CACHE_VIEWS=false
|
||||
DRIVE_DISK=local
|
||||
S3_KEY=dummyKey
|
||||
S3_SECRET=dummySecret
|
||||
S3_BUCKET=dummyBucket
|
||||
S3_REGION=dummyRegion
|
||||
S3_ENDPOINT=dummyEndpoint
|
||||
S3_REGION=dummyRegion
|
||||
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@ -0,0 +1,30 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG NODE_IMAGE=node:17-alpine
|
||||
|
||||
FROM ${NODE_IMAGE} as base
|
||||
RUN apk --no-cache add dumb-init
|
||||
RUN mkdir -p /home/node/app && chown node:node /home/node/app
|
||||
WORKDIR /home/node/app
|
||||
USER node
|
||||
RUN mkdir tmp
|
||||
|
||||
FROM base as dependencies
|
||||
COPY --chown=node:none ./package*.json ./
|
||||
RUN npm ci
|
||||
COPY --chown=node:node . .
|
||||
|
||||
FROM dependencies as build
|
||||
RUN node ace build --production --ignore-ts-errors
|
||||
|
||||
FROM base as production
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3333
|
||||
ENV HOST=0.0.0.0
|
||||
|
||||
COPY --chown=node:node ./package*.json ./
|
||||
RUN npm ci --production
|
||||
COPY --chown=node:node --from=build /home/node/app/build .
|
||||
EXPOSE 3333
|
||||
CMD [ "dumb-init", "node", "server.js" ]
|
||||
@ -43,6 +43,7 @@ const databaseConfig: DatabaseConfig = {
|
||||
database: Env.get('PG_DB_NAME'),
|
||||
},
|
||||
migrations: {
|
||||
disableRollbacksInProduction: true,
|
||||
naturalSort: true,
|
||||
tableName: 'migrations',
|
||||
},
|
||||
|
||||
44
docker-compose.yml
Normal file
44
docker-compose.yml
Normal file
@ -0,0 +1,44 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
backend:
|
||||
container_name: educt-server
|
||||
restart: always
|
||||
build:
|
||||
context: .
|
||||
target: dependencies
|
||||
ports:
|
||||
- ${PORT}:${PORT}
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- PG_HOST=postgres
|
||||
- REDIS_HOST=redis
|
||||
volumes:
|
||||
- ./:/home/node/app
|
||||
command: dumb-init node ace serve --watch
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
postgres:
|
||||
container_name: postgres
|
||||
image: postgres:14
|
||||
volumes:
|
||||
- postgres_volume:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_USER: ${PG_USER}
|
||||
POSTGRES_PASSWORD: ${PG_PASSWORD}
|
||||
POSTGRES_DB: ${PG_DB_NAME}
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
redis:
|
||||
container_name: redis
|
||||
image: redis:6-alpine
|
||||
volumes:
|
||||
- redis_volume:/data
|
||||
ports:
|
||||
- 6379:6379
|
||||
volumes:
|
||||
postgres_volume:
|
||||
redis_volume:
|
||||
11309
package-lock.json
generated
11309
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -48,7 +48,6 @@
|
||||
"luxon": "^1.28.0",
|
||||
"nanoid": "^3.1.25",
|
||||
"pg": "^8.7.1",
|
||||
"phc-bcrypt": "^1.0.7",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"socket.io": "^4.4.1",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user