Skip to content

Instantly share code, notes, and snippets.

@bogordesaincom
Created January 1, 2025 02:32
Show Gist options
  • Select an option

  • Save bogordesaincom/2fa8060c5b2bb7f0854239a9feeb8e8a to your computer and use it in GitHub Desktop.

Select an option

Save bogordesaincom/2fa8060c5b2bb7f0854239a9feeb8e8a to your computer and use it in GitHub Desktop.
Docker
# Base image
FROM oven/bun:1 as base
WORKDIR /usr/src/app
# Install dependencies
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install
# Build Development
RUN mkdir -p /temp/prod
COPY . /temp/prod/
ENV NODE_ENV production
RUN bun add --global @angular/cli
RUN apt-get update && apt-get install -y nodejs
WORKDIR /temp/prod
RUN bun install --production && bunx ng build --configuration production
# Prepare for release
FROM install AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# Build Production
FROM nginx:alpine as runner
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=prerelease /usr/src/app/dist/cuba/browser /usr/share/nginx/html
EXPOSE 3000
ENTRYPOINT ["nginx", "-g", "daemon off;"]
server {
listen 3000;
server_name _;
server_tokens off;
root /usr/share/nginx/html;
include /etc/nginx/mime.types;
location / {
try_files $uri $uri/ /index.html;
}
gzip on;
gzip_vary on;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 256;
gunzip on;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment