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

🧐[问题 | Need a Dockerfile] #11206

Closed
arn-ob opened this issue Apr 8, 2024 · 1 comment
Closed

🧐[问题 | Need a Dockerfile] #11206

arn-ob opened this issue Apr 8, 2024 · 1 comment

Comments

@arn-ob
Copy link

arn-ob commented Apr 8, 2024

Please share a proper dockerfile. When create a own dockerfile, it doesn't build, giving some package error. When I run my local machine, it work perfectly

@arn-ob arn-ob changed the title 🧐[问题 | Need a proper Dockerfile] 🧐[问题 | Need a Dockerfile] Apr 8, 2024
@arn-ob
Copy link
Author

arn-ob commented Apr 9, 2024

My workable dockerfile 😄

# Use a Node.js base image
FROM node:16-alpine as builder

# Set the working directory in the container
WORKDIR /app

COPY . .

RUN npm install -g pnpm

# Copy package.json and package-lock.json to the container
COPY package*.json ./


# Install project dependencies
RUN pnpm install

# Build the production version of the project
RUN pnpm build

# Stage 2: Serve the built application using Nginx
FROM nginx:alpine

# Copy the built application from the builder stage to the nginx directory
COPY --from=builder /app/dist /usr/share/nginx/html

# Expose port 80
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]

@arn-ob arn-ob closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant