Skip to content

Commit

Permalink
Added dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
enochval committed Jun 18, 2024
1 parent d5957eb commit c7db642
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: NestJS JSON Placeholder API GraphQL Hub Deployment
name: GraphQL Placeholder Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
Expand Down
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
###################
# BUILD FOR LOCAL DEVELOPMENT
###################

FROM node:22-alpine As development

WORKDIR /usr/src/app

COPY --chown=node:node package*.json ./

RUN npm ci

COPY --chown=node:node . .

USER node

###################
# BUILD FOR PRODUCTION
###################

FROM node:22-alpine As build

WORKDIR /usr/src/app

COPY --chown=node:node package*.json ./

COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules

COPY --chown=node:node . .

RUN npm run build

ENV NODE_ENV production

RUN npm ci --only=production && npm cache clean --force

USER node

###################
# PRODUCTION
###################

FROM node:22-alpine As production

COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/dist ./dist

CMD [ "node", "dist/main.js" ]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"author": "osarenrenenoch@gmail.com",
"private": true,
"license": "UNLICENSED",
"license": "LICENSED",
"scripts": {
"build": "nest build",
"postbuild": "copyfiles -u 1 src/**/*.graphql dist/",
Expand Down
3 changes: 0 additions & 3 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ <h2>Try it</h2>
</b> when making requests to GraphQLPlaceholder.
</p>

<div id="codefund"><!-- fallback content --></div>
<script src="https://app.codefund.io/properties/338/funder.js" async="async"></script>

<!-- Resources -->
<h2>Queries</h2>
<p>
Expand Down

0 comments on commit c7db642

Please sign in to comment.