-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
38 lines (24 loc) · 828 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use an official Node.js runtime as the base image
FROM node:18.20.3-bullseye
# Install Nginx
RUN apt-get update && apt-get install -y nginx certbot python3-certbot-dns-cloudflare
# Create directory for Nginx configuration files
RUN mkdir -p /etc/nginx/conf.d/
# Create directory for Let's Encrypt certificates
RUN mkdir -p /etc/letsencrypt/
# Make sure Nginx has the right permissions to run
RUN chown -R www-data:www-data /var/lib/nginx
# Create app directory
WORKDIR /app
# Bundle app source
COPY . .
# Install dependencies & build
RUN yarn && yarn build
# Expose port 8080 & 443
EXPOSE 8080 443
# Remove the default Nginx configuration file
RUN rm /etc/nginx/sites-enabled/default
# Copy a custom Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf
# Start Node.js app
CMD ["node", "dist/index.js"]