feat: containerize backend and frontend services

This commit is contained in:
ramvignesh-b
2026-04-22 19:14:21 +05:30
parent 59ea95a912
commit a986878a3b
5 changed files with 73 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
node_modules
test-results
playwright-report
dist
coverage
+32
View File
@@ -0,0 +1,32 @@
FROM oven/bun:1 AS bun
WORKDIR /app
COPY package.json bun.lock* ./
RUN bun install --frozen-lockfile
COPY . .
ARG BACKEND_DOMAIN
ARG BACKEND_PORT
ARG SSL_ENABLED
ARG VITE_API_URL
ENV BACKEND_DOMAIN=$BACKEND_DOMAIN
ENV BACKEND_PORT=$BACKEND_PORT
ENV SSL_ENABLED=$SSL_ENABLED
ENV VITE_API_URL=$VITE_API_URL
RUN bun run build:prod
FROM nginxinc/nginx-unprivileged:alpine-slim
RUN touch /tmp/access.log /tmp/error.log
RUN rm /etc/nginx/conf.d/*
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=bun /app/dist /usr/share/nginx/html
# transfer the ownership since nginx is running rootless
USER root
RUN chown -R nginx:nginx /usr/share/nginx/html
USER nginx
EXPOSE 8080
ENTRYPOINT ["nginx", "-e", "/tmp/error.log", "-g", "daemon off;"]
+23
View File
@@ -0,0 +1,23 @@
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
access_log /tmp/access.log;
error_log /tmp/error.log;
server {
listen 8080;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri /index.html;
}
}
}