Skip to content

Commit

Permalink
feat: Deployment (#16)
Browse files Browse the repository at this point in the history
* Backend docker file
* Frontend docker file + nginx config
  • Loading branch information
cbolles committed Nov 21, 2024
1 parent e25190c commit ce58c83
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 10 deletions.
16 changes: 16 additions & 0 deletions packages/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:22

WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./
RUN npm install

# Copy over the source
COPY . .
RUN npm run build

# Expore the default port
EXPOSE 3000

CMD ["npm", "run", "start:prod"]
3 changes: 2 additions & 1 deletion packages/backend/src/config/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default () => ({
accessID: process.env.S3_ACCESS_KEY_ID,
accessSecret: process.env.S3_SECRET_ACCESS_KEY,
endpoint: process.env.S3_ENDPOINT_URL,
bucket: process.env.S3_BUCKET
bucket: process.env.S3_BUCKET,
region: process.env.S3_REGION || 'us-east-1'
},
runner: {
image: process.env.RUNNER_IMAGE || 'hicsail/comets-runner:latest',
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/s3/s3.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const s3Provider: Provider<S3Client> = {
secretAccessKey: configService.getOrThrow<string>('s3.accessSecret')
},
endpoint: configService.getOrThrow<string>('s3.endpoint'),
forcePathStyle: true
forcePathStyle: true,
region: configService.getOrThrow<string>('s3.region')
});
},
inject: [ConfigService]
Expand Down
9 changes: 2 additions & 7 deletions packages/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
FROM node:18-alpine as builder


FROM node:18-alpine AS builder

ARG VITE_COMETS_BACKEND
ARG VITE_COMETS_FLASK

ENV VITE_COMETS_BACKEND ${VITE_COMETS_BACKEND}
ENV VITE_COMETS_FLASK ${VITE_COMETS_FLASK}
ENV VITE_COMETS_BACKEND=${VITE_COMETS_BACKEND}

WORKDIR /usr/src/app
COPY . .
Expand Down
36 changes: 35 additions & 1 deletion packages/frontend/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ events {
}

http {
# perl_modules /opt/app-root/etc/perl;
# perl_require Version.pm;
# perl_set $perl_version Version::installed;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
Expand Down Expand Up @@ -56,4 +59,35 @@ http {
location = /50x.html {
}
}
}

# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /opt/app-root/src;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers PROFILE=SYSTEM;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /opt/app-root/etc/nginx.default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }

}

0 comments on commit ce58c83

Please sign in to comment.