-
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.
- Loading branch information
1 parent
aacf57e
commit 96b4356
Showing
7 changed files
with
100 additions
and
34 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,10 +1,31 @@ | ||
FROM node | ||
# Step 1: Build the application | ||
FROM node:18 AS build | ||
|
||
WORKDIR /app | ||
|
||
# Kopiere nur package.json und package-lock.json für den npm install-Befehl | ||
COPY package.json . | ||
COPY package-lock.json . | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
# Kopiere den Rest des Codes nach dem Installieren der Dependencies | ||
COPY . . | ||
|
||
# Baue die Anwendung | ||
RUN npm run build | ||
|
||
# Step 2: Serve the application | ||
FROM nginx:alpine | ||
|
||
|
||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Kopiere die gebauten Dateien in das Nginx-Verzeichnis | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
|
||
# Nginx auf Port 8080 aussetzen | ||
EXPOSE 8080 | ||
|
||
# Nginx im Vordergrund ausführen | ||
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
gzip on; | ||
|
||
server { | ||
listen 8080; | ||
server_name mac-server; | ||
|
||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri /index.html; | ||
} | ||
|
||
# Optionale Fehlerseiten | ||
error_page 404 /404.html; | ||
location = /404.html { | ||
root /usr/share/nginx/html; | ||
internal; | ||
} | ||
} | ||
} |
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
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