Skip to content

Commit

Permalink
Prune docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthlogic committed Aug 14, 2023
1 parent 98f500c commit be55df6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ npm-debug.log
Dockerfile
.dockerignore
.github
fly.toml
fly.toml
.gitpod.yml
.gitignore
PostmanCollections
.eslintrc
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
run: |
docker buildx create --use
docker buildx build --platform linux/amd64 -t ghcr.io/${{ github.repository }}:latest .
docker buildx build --platform linux/amd64 -t ghcr.io/${{ github.repository }}:main .
docker buildx stop
deploy_to_fly:
Expand Down
29 changes: 16 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
FROM node:alpine
# Use the official Node.js image as base
FROM node:16-alpine

LABEL maintainer="Srikanth <srikanth@cashlessconsumer.in>"

LABEL version="1.0"

LABEL description="Docker image for running Google Play API"

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
# Set metadata labels
LABEL maintainer="Srikanth <srikanth@cashlessconsumer.in>" \
version="1.0" \
description="Docker image for running Google Play API"

# Create and set the working directory
WORKDIR /home/node/app

COPY --chown=node:node package*.json ./
# Copy only the package.json and package-lock.json first to leverage Docker caching
COPY package*.json ./

USER node

RUN npm install
# Install dependencies
RUN npm ci --quiet --only=production

COPY --chown=node:node . .
# Copy the rest of the application code
COPY . .

# Expose port 3000
EXPOSE 3000

# Set the user to 'node' and run the application using npm start
USER node
CMD [ "npm", "start" ]

0 comments on commit be55df6

Please sign in to comment.