feat(infra): reworked everything so that a single docker builds all + made sure everything works
This commit is contained in:
parent
68f8d87477
commit
157b06ea4b
7 changed files with 23 additions and 14 deletions
|
|
@ -28,11 +28,7 @@ services:
|
||||||
# - write icons to shared volume allowing nginx to serve them (does it better than if we did it in the service)
|
# - write icons to shared volume allowing nginx to serve them (does it better than if we did it in the service)
|
||||||
icons:
|
icons:
|
||||||
# build is a bit strange: it has two parts
|
# build is a bit strange: it has two parts
|
||||||
build:
|
build: ./src/icons/
|
||||||
# the dockerfile to use
|
|
||||||
dockerfile: ./src/icons/Dockerfile
|
|
||||||
# the current working directory. This means `.` in Dockerfile
|
|
||||||
context: .
|
|
||||||
container_name: icons
|
container_name: icons
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2025/06/12 16:42:38 by maiboyer #+# #+# #
|
# Created: 2025/06/12 16:42:38 by maiboyer #+# #+# #
|
||||||
# Updated: 2025/06/16 21:21:16 by maiboyer ### ########.fr #
|
# Updated: 2025/07/29 13:58:39 by maiboyer ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -22,6 +22,8 @@ RUN \
|
||||||
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
-keyout /etc/ssl/private/nginx-selfsigned.key \
|
||||||
-out /etc/ssl/certs/nginx-selfsigned.crt \
|
-out /etc/ssl/certs/nginx-selfsigned.crt \
|
||||||
-subj "/C=FR/OU=student/CN=${NGINX_DOMAIN}"
|
-subj "/C=FR/OU=student/CN=${NGINX_DOMAIN}"
|
||||||
|
|
||||||
COPY ./15-local-resolvers.envsh /docker-entrypoint.d/
|
COPY ./15-local-resolvers.envsh /docker-entrypoint.d/
|
||||||
COPY ./17-add-template-prefix.sh /docker-entrypoint.d/
|
COPY ./17-add-template-prefix.sh /docker-entrypoint.d/
|
||||||
|
|
||||||
COPY ./conf /etc/nginx/templates
|
COPY ./conf /etc/nginx/templates
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ server {
|
||||||
charset UTF-8;
|
charset UTF-8;
|
||||||
listen [::]:443 ssl;
|
listen [::]:443 ssl;
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name $NGINX_DOMAIN;
|
|
||||||
resolver $NGINX_RESOLVERS;
|
resolver $NGINX_RESOLVERS;
|
||||||
|
server_name $NGINX_DOMAIN;
|
||||||
|
|
||||||
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||||
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
#forward the post request to the microservice
|
||||||
location /api/icons/set/ {
|
location /api/icons/set/ {
|
||||||
rewrite ^/api/icons/set/(.*) $1 break;
|
rewrite ^/api/icons/set/(.*) $1 break;
|
||||||
proxy_pass http://icons-service/set/$uri;
|
proxy_pass http://icons/set/$uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#handle the get request with nginx, since it does this well
|
||||||
location /api/icons/get/ {
|
location /api/icons/get/ {
|
||||||
rewrite ^/api/icons/get/(.*) /$1 break;
|
rewrite ^/api/icons/get/(.*) /$1 break;
|
||||||
root /volumes/icons;
|
root /volumes/icons;
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,21 @@
|
||||||
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2025/07/28 16:33:09 by maiboyer #+# #+# #
|
# Created: 2025/07/28 16:33:09 by maiboyer #+# #+# #
|
||||||
# Updated: 2025/07/28 17:46:49 by maiboyer ### ########.fr #
|
# Updated: 2025/07/29 13:54:54 by maiboyer ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
# this file will be used to build everything at once
|
# this file will be used to build everything at once
|
||||||
# then all the other Dockerfiles will just copy from this one...
|
# then all the other Dockerfiles will just copy from this one...
|
||||||
#
|
#
|
||||||
# it'll always be tagged as `ft_transcendance_global`
|
# it'll always be tagged as `trans_builder`
|
||||||
# this is VERY UGLY
|
# this is VERY UGLY
|
||||||
# I didn't find really a lot of other ways to do this thought...
|
# I didn't find really a lot of other ways to do this thought...
|
||||||
# so yeah have mercy :P
|
# so yeah have mercy :P
|
||||||
|
|
||||||
|
|
||||||
|
# please do not touch this file unless you know what you are doing :)
|
||||||
|
|
||||||
FROM node:24-alpine
|
FROM node:24-alpine
|
||||||
|
|
||||||
RUN apk add python3;
|
RUN apk add python3;
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,13 @@
|
||||||
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2025/06/16 14:57:11 by maiboyer #+# #+# #
|
# Created: 2025/06/16 14:57:11 by maiboyer #+# #+# #
|
||||||
# Updated: 2025/07/28 17:59:09 by maiboyer ### ########.fr #
|
# Updated: 2025/07/29 13:53:21 by maiboyer ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
FROM trans_builder
|
FROM trans_builder
|
||||||
|
|
||||||
CMD ["node", "/src/icons/run.js"]
|
# do extra stuff that is specific for this service here !
|
||||||
|
|
||||||
|
CMD ["node", "/src/icons/dist/run.js"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ const example: FastifyPluginAsync = async (fastify, opts): Promise<void> => {
|
||||||
}
|
}
|
||||||
const image_store: string = fastify.getDecorator('image_store')
|
const image_store: string = fastify.getDecorator('image_store')
|
||||||
const image_path = join(image_store, userid)
|
const image_path = join(image_store, userid)
|
||||||
|
|
||||||
|
//let raw_image_file = await open(image_path + ".raw", "w", 0o666)
|
||||||
|
//await raw_image_file.write(request.rawBody as Buffer);
|
||||||
|
//await raw_image_file.close()
|
||||||
try {
|
try {
|
||||||
let img = sharp(request.rawBody as Buffer);
|
let img = sharp(request.rawBody as Buffer);
|
||||||
img.resize({
|
img.resize({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue