Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dockerfile #3

Merged
merged 14 commits into from
Apr 18, 2024
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"]