Skip to content

Commit

Permalink
Merge pull request #3 from joaovictornsv/feat/dockerignore-2
Browse files Browse the repository at this point in the history
update dockerfile
  • Loading branch information
joaovictornsv authored Apr 18, 2024
2 parents ecfa05d + 11ca91b commit ca588e5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/zcloud-git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ on:

jobs:
deploy-apps:
env:
__ZCLOUD_INTERNAL_API_CLIENT_URI: 'https://api.zcloud.land'
__ZCLOUD_INTERNAL_ENV: 'staging'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: zcloud-ws/zcloud-deploy-action@main
with:
user-token: ${{ secrets.ZCLOUD_USER_TOKEN }}
env: joaovictornsv-local-list-dev
user-token: ${{ secrets.ZCLOUD_USER_TOKEN_STAGING }}
env: joaovictornsv-staging-3-local-list-cli-production
dir: .
4 changes: 2 additions & 2 deletions .github/workflows/zcloud-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
- uses: zcloud-ws/zcloud-deploy-action@main
with:
user-token: ${{ secrets.ZCLOUD_USER_TOKEN_STAGING }}
dir: .
cli-extra-args: '--app local-list-cli --create'
app: local-list-cli
cli-extra-args: '--create'
36 changes: 36 additions & 0 deletions Dockeryzer.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# --------------------> The build image
# Use the Node.js image based on Debian Bullseye for the build phase.
# Customization suggestion: You can change the base image to a different version of Node.js, such as 'node:slim' or 'node:alpine', if necessary.
FROM node:alpine AS builder

# Set the 'node:node' user to run subsequent commands, ensuring a secure and restricted environment.
USER node:node

# Set the working directory for the application in the build phase.
# Customization suggestion: If your application's working directory is different, you can modify it by changing the value of the WORKDIR variable.
WORKDIR /workspace/app

# Copy all files from the current host directory to the application's working directory in the container.
COPY --chown=node:node . /workspace/app

# Install only production dependencies, optimizing the build process, and clean npm cache.
RUN npm ci --only=production && npm run build && npm cache clean --force

# --------------------> The production image
# Again, use the Node.js image based on Debian Bullseye for the production phase.
FROM node:alpine

# Copy the compiled files from the build phase to the '/app' directory in the container.
COPY --from=builder --chown=node:node /workspace/app/dist /app

# Set the default user to run subsequent commands.
USER node

# Set the working directory for the application in the production phase.
WORKDIR /app

# Start the static server using the locally installed serve.
# Customization suggestions:
# - The default server port is set to 3000. You can change it as needed by modifying the '-p' argument in the CMD command.
# - If you prefer to use a different server or add more options to the execution command, you can modify the CMD as needed.
CMD ["npx", "serve", "-p", "3000", "-s", "/app"]

0 comments on commit ca588e5

Please sign in to comment.