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

Small image #26

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Start your image with a node base image
FROM node:18-alpine
FROM node:18-alpine as builder

# The /app directory should act as the main application directory
WORKDIR /app
Expand All @@ -13,11 +13,8 @@ COPY ./public ./public

# Install node packages, install serve, build the app, and remove dependencies at the end
RUN npm install \
&& npm install -g serve \
&& npm run build \
&& rm -fr node_modules
&& npm run build

EXPOSE 3000

# Start the app using serve command
CMD [ "serve", "-s", "build" ]
# Use a slim nginx image to reduce our image size drastically
FROM nginx:alpine-slim
COPY --from=builder /app/build /usr/share/nginx/html