0.1.4
This commit is contained in:
		
							
								
								
									
										40
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								Dockerfile
									
									
									
									
									
								
							@@ -1,7 +1,37 @@
 | 
			
		||||
# Create the container from the alpine linux image
 | 
			
		||||
#FROM alpine:3.7
 | 
			
		||||
FROM node:22-alpine
 | 
			
		||||
WORKDIR /usr/src/app
 | 
			
		||||
COPY package*.json ./
 | 
			
		||||
RUN npm i
 | 
			
		||||
 | 
			
		||||
# Add nginx and nodejs
 | 
			
		||||
#RUN apk add --update nginx nodejs
 | 
			
		||||
RUN apk add --update nginx
 | 
			
		||||
 | 
			
		||||
# Create the directories we will need
 | 
			
		||||
RUN mkdir -p /tmp/nginx/vue-single-page-app
 | 
			
		||||
RUN mkdir -p /var/log/nginx
 | 
			
		||||
RUN mkdir -p /var/www/html
 | 
			
		||||
 | 
			
		||||
# Copy the respective nginx configuration files
 | 
			
		||||
COPY nginx/nginx.conf /etc/nginx/nginx.conf
 | 
			
		||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
 | 
			
		||||
 | 
			
		||||
# Set the directory we want to run the next commands for
 | 
			
		||||
WORKDIR /tmp/nginx/vue-single-page-app
 | 
			
		||||
 | 
			
		||||
COPY . .
 | 
			
		||||
EXPOSE 8080
 | 
			
		||||
CMD ["npm", "run", "serve"]
 | 
			
		||||
# Copy our source code into the container
 | 
			
		||||
# Install the dependencies, can be commented out if you're running the same node version
 | 
			
		||||
RUN npm install
 | 
			
		||||
 | 
			
		||||
# run webpack and the vue-loader
 | 
			
		||||
RUN npm run build-only
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# copy the built app to our served directory
 | 
			
		||||
RUN cp -r dist/* /var/www/html
 | 
			
		||||
 | 
			
		||||
# make all files belong to the nginx user
 | 
			
		||||
RUN chown nginx:nginx /var/www/html
 | 
			
		||||
 | 
			
		||||
# start nginx and keep the process from backgrounding and the container from quitting
 | 
			
		||||
CMD ["nginx", "-g", "daemon off;"]
 | 
			
		||||
		Reference in New Issue
	
	Block a user