Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

fix: updates to Docker images for consistency across Gateway services #91

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:
with:
flavor: |
latest=auto
prefix=api-,onlatest=true
images: |
${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}
tags: |
Expand All @@ -75,4 +74,4 @@ jobs:
platforms: linux/amd64
push: ${{env.TEST_RUN != 'true'}}
file: ./Dockerfile
tags: ${{ steps.cp-tags.outputs.tags }}
tags: ${{ steps.cp-tags.outputs.tags }}
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 18.16.0
nodejs 20.12.2
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use a multi-stage build for efficiency
FROM node:18 AS builder
FROM node:20 AS builder

WORKDIR /usr/src/app

Expand All @@ -13,17 +13,18 @@ COPY . .
RUN npm run build

# Production stage
FROM node:18
FROM node:20

WORKDIR /usr/src/app

COPY --from=builder /usr/src/app/dist ./dist
COPY package*.json ./

COPY ./lua ./lua

RUN npm install --only=production

EXPOSE 3000
ENV START_PROCESS="api"

ENV START_PROCESS="api"

CMD ["sh", "-c", "if [ \"$START_PROCESS\" = \"api\" ]; then npm run start:api:prod; else npm run start:worker:prod; fi"]
ENTRYPOINT ["npm", "run", "start:${START_PROCESS}:prod"]
2 changes: 1 addition & 1 deletion apps/worker/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ async function bootstrap() {
const app = await NestFactory.createApplicationContext(WorkerModule);
app.enableShutdownHooks();
}
bootstrap();
bootstrap().catch((error) => console.error(error));
11 changes: 7 additions & 4 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM node:18
FROM node:20

WORKDIR /app
COPY . .

RUN npm install
# COPY . .

# RUN npm install

EXPOSE 3000

ENV START_PROCESS="api"

CMD ["sh", "-c", "if [ \"$START_PROCESS\" = \"api\" ]; then npm run start:api; else npm run start:worker; fi"]
ENTRYPOINT npm run start:${START_PROCESS}:watch
14 changes: 9 additions & 5 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- content-publishing-service

frequency:
image: frequencychain/instant-seal-node:latest
JoeCap08055 marked this conversation as resolved.
Show resolved Hide resolved
image: dsnp/instant-seal-node-with-deployed-schemas:latest
ports:
- 9944:9944
networks:
Expand All @@ -31,16 +31,19 @@ services:
- ipfs_data:/data/ipfs

content-publishing-service-api:
pull_policy: never
image: content-publishing-service
build:
context: .
dockerfile: dev.Dockerfile
tags:
- content-publishing-service:latest
ports:
- 3000:3000
env_file:
- .env.docker.dev
environment:
- START_PROCESS=api
- REDIS_URL=redis://redis:6379
JoeCap08055 marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- ./:/app
depends_on:
Expand All @@ -51,14 +54,17 @@ services:
- content-publishing-service

content-publishing-service-worker:
pull_policy: never
image: content-publishing-service
build:
context: .
dockerfile: dev.Dockerfile
tags:
- content-publishing-service:latest
env_file:
- .env.docker.dev
environment:
- START_PROCESS=worker
- REDIS_URL=redis://redis:6379
volumes:
- ./:/app
depends_on:
Expand All @@ -75,5 +81,3 @@ volumes:

networks:
content-publishing-service:


4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"generate-swagger-ui": "redoc-cli bundle swagger.yaml --output=./docs/index.html",
"format": "prettier --write \"apps/**/*.ts\" \"libs/**/*.ts\"",
"start:api": "nest start api",
"start:api:prod": "node dist/apps/api/main.js",
"start:api:watch": "nest start api --watch",
"start:api:prod": "node dist/apps/api/main.js",
"start:worker": "nest start worker",
"start:worker:watch": "nest start worker --watch",
"start:worker:prod": "node dist/apps/worker/main.js",
"start:api:dev": "set -a ; . .env ; nest start api",
"start:worker:dev": "set -a ; . .env ; nest start worker",
Expand Down
Loading