-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
52 lines (42 loc) · 1.78 KB
/
Dockerfile.dev
File metadata and controls
52 lines (42 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Use an official Node.js runtime as a parent image
# Using node 20 slim for smaller image size
FROM node:20-slim
# Set environment variables
ENV NODE_ENV=development
ENV VITE_HOST=0.0.0.0
ENV VITE_PORT=5173
# Install necessary packages for health check and potential dependencies
# Add Tailscale installation steps
RUN apt-get update && apt-get install -y \
curl \
gnupg \
apt-transport-https \
# Add any other necessary system dependencies here
&& curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg | tee /usr/share/keyrings/tailscale-archive-keyring.gpg > /dev/null \
&& curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring.list | tee /etc/apt/sources.list.d/tailscale.list \
&& apt-get update \
&& apt-get install -y tailscale \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json (if available)
# Using separate COPY commands leverages Docker cache
COPY package.json ./
# COPY package-lock.json ./
# Install project dependencies (using npm install instead of npm ci)
# This will generate a package-lock.json if one doesn't exist
# Consider installing npm 9 explicitly if base image doesn't have it
RUN npm install -g npm@9.x # Ensure a consistent modern npm version
RUN npm install
# Copy the rest of the application code
COPY . .
# Expose the Vite port and HMR port
EXPOSE 5173
EXPOSE 24678
# Command to run the Vite development server
# CMD is overridden by ENTRYPOINT script
# Use an entrypoint script to handle Tailscale networking
COPY docker-entrypoint.dev.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.dev.sh
ENTRYPOINT ["docker-entrypoint.dev.sh"]
CMD ["npm", "run", "dev"] # Default command passed to entrypoint