From bc060904371878e5bacd0141f93ca87cb5b6db44 Mon Sep 17 00:00:00 2001 From: Dm1tr1y147 Date: Tue, 10 Nov 2020 23:14:35 +0500 Subject: [PATCH] Added dockerfile and getting port from environment variable --- Dockerfile | 7 +++++++ src/index.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d9f8c51 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node:14.4.0 +USER root +WORKDIR /backend +COPY . /backend +RUN yarn +RUN yarn build +CMD [ "node", "./dist/index.js" ] \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index ee0a2e8..e38bbf8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,7 +51,7 @@ const server = new ApolloServer({ server.applyMiddleware({ app }) -const port = process.env.PORT || 4000 +const port = process.env.BACKEND_PORT || 4000 app.listen(port, () => { console.log(`Server ready at http://localhost:${port}`)