Skip to content

Instantly share code, notes, and snippets.

@indraAsLesmana
Last active July 31, 2024 14:25
Show Gist options
  • Save indraAsLesmana/72e71cfbf448a43b49089cfa93498c45 to your computer and use it in GitHub Desktop.
Save indraAsLesmana/72e71cfbf448a43b49089cfa93498c45 to your computer and use it in GitHub Desktop.
Build docker image, production React + Typescript + Tailwinds + ViteJS
add to vite.config.ts:
server: {
port: 9393,
strictPort: true,
host: true,
origin: "http://0.0.0.0:9393",
},
Dockerfile:
FROM node:18-alpine
WORKDIR /app
COPY package.json .
RUN npm install
RUN npm i -g serve
COPY . .
RUN npm run build
EXPOSE 3000
CMD [ "serve", "-s", "dist" ]
Build:
docker build . -t "sample-project:v1.0"
docker run -p 9394:3000 sample-project:v1.0
http://server-ip:3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment