-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from JonathanBout/main
Docker fixes
- Loading branch information
Showing
5 changed files
with
38 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
FROM node:lts-alpine | ||
|
||
# install simple http server for serving static content | ||
RUN npm install -g http-server | ||
|
||
# make the 'app' folder the current working directory | ||
# Use the node image from official Docker Hub | ||
FROM node:lts-alpine as build-stage | ||
# set the working directory | ||
WORKDIR /app | ||
|
||
# copy both 'package.json' and 'package-lock.json' (if available) | ||
# Copy the working directory in the container | ||
COPY package*.json ./ | ||
|
||
# install project dependencies | ||
# Install the project dependencies | ||
RUN npm install | ||
|
||
# copy project files and folders to the current working directory (i.e. 'app' folder) | ||
# Copy the rest of the project files to the container | ||
COPY . . | ||
|
||
# build app for production with minification | ||
# Build the Vue.js application to the production mode to dist folder | ||
RUN npm run build | ||
|
||
EXPOSE 5000 | ||
CMD [ "http-server", "dist", "-p", "5000" ] | ||
# Use the lightweight Nginx image from the previous stage for the nginx container | ||
FROM nginx:stable-alpine as production-stage | ||
WORKDIR /app | ||
# Copy the build application from the previous stage to the Nginx container | ||
COPY --from=build-stage /app/dist ./ | ||
# Copy the nginx configuration file | ||
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf | ||
# Expose the port 80 | ||
EXPOSE 80 | ||
# Start Nginx to serve the application | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ services: | |
environment: | ||
NODE_ENV: production | ||
ports: | ||
- 20000:5000 | ||
- 20000:80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
root /app; | ||
index index.html; | ||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters