Skip to content

Instantly share code, notes, and snippets.

@lxchurbakov
Last active May 22, 2023 06:57
Show Gist options
  • Save lxchurbakov/b7886515805e321e3975c8438d9d99b7 to your computer and use it in GitHub Desktop.
Save lxchurbakov/b7886515805e321e3975c8438d9d99b7 to your computer and use it in GitHub Desktop.
deployment-stuff
// nginx.conf
events { }
http {
include mime.types;
include /etc/nginx/conf.d/*;
}
// default.conf
// See $PORT is taken from container run envs
server {
listen ${PORT};
listen [::]:${PORT};
root /usr/share/nginx/html;
# index index.html index.html;
location / {
}
}
// Dockerfile
FROM node:alpine
WORKDIR /app
COPY src ./src
COPY package.json .
COPY tsconfig.json .
# Install PYTHON for node-gyp to work
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*
RUN npm install
RUN npm run build
# Now put it inside nginx
# TODO uncomment that when I find out how to inject envs into build or hijack them in runtime
FROM nginx:latest
ENV PORT=9000
COPY nginx.conf /etc/nginx/nginx.conf
COPY default.conf /etc/nginx/templates/default.conf.template
COPY --from=0 /app/dist /usr/share/nginx/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment