Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ RUN pnpm build
FROM nginx:stable-alpine AS production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
COPY startup.sh /docker-entrypoint.d/startup.sh
ENV PORT 80
EXPOSE ${PORT}
CMD ["nginx", "-g", "daemon off;"]
15 changes: 15 additions & 0 deletions startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# Generate the nginx.conf with PORT env or default to 80
cat > /etc/nginx/conf.d/default.conf <<EOF
server {
listen ${PORT:-80};
server_name localhost;
root /usr/share/nginx/html;
index index.html;

location / {
try_files \$uri \$uri/ /index.html;
}
}
EOF