Skip to content

Commit 261f31b

Browse files
committed
Add Dockerfile and change default port
1 parent 82d158d commit 261f31b

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.github/
2+
.husky/
3+
node_modules/
4+
.env.example
5+
README
6+

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PORT=3000
1+
PORT=8000

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:18
2+
3+
RUN mkdir /app
4+
WORKDIR /app
5+
6+
COPY . .
7+
8+
RUN yarn install --frozen-lockfile
9+
10+
EXPOSE 8000
11+
CMD ["yarn", "start"]
12+

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"name": "validator-api",
3-
"version": "1.0.0",
4-
"description": "Validate Airnode config files over HTTP",
5-
"main": "index.js",
63
"author": "ChainAPI <https://chainapi.com>",
74
"license": "MIT",
5+
"version": "1.0.0",
6+
"description": "Validate Airnode config files over HTTP",
7+
"private": false,
8+
"main": "dist/src/index",
9+
"types": "dist/src/index",
10+
"files": [
11+
"dist"
12+
],
813
"scripts": {
914
"build": "yarn clean && yarn tsc",
1015
"clean": "rimraf -rf ./dist",

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import Fastify from 'fastify';
21
import dotenv from 'dotenv';
2+
import Fastify from 'fastify';
33

44
dotenv.config();
55

66
const fastify = Fastify({ logger: true });
77

88
fastify.get('/', async (_request, reply) => {
99
reply.type('application/json').code(200);
10-
return { hello: 'world' };
10+
return { status: 'alive' };
1111
});
1212

13-
const PORT = Number(process.env.PORT) || 3000;
13+
const PORT = Number(process.env.PORT) || 8000;
1414
fastify.listen({ port: PORT }, (err, _address) => {
1515
if (err) throw err;
1616
});

0 commit comments

Comments
 (0)