Skip to content

Commit

Permalink
refactor: reposition php code in the folder (#25)
Browse files Browse the repository at this point in the history
refactor: rename login/ -> php/\n\ncalling the folder php is more representative of what there is inside

refactor: move files from public folder to private

refactor: move Dockerfile in their own folder
  • Loading branch information
Rignchen committed Jun 10, 2024
1 parent a5214ed commit 3148fca
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 20 deletions.
12 changes: 0 additions & 12 deletions Dockerfile.Php

This file was deleted.

10 changes: 5 additions & 5 deletions Dockerfile.Nginx → Dockerfile/Dockerfile.Nginx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# node 20, build the application
FROM node:20.12.2-alpine3.19
COPY Interface .
COPY ../Interface .
RUN npm install
RUN npm run build


# nginx 1.26 on port 80, keep the build output, nginx config
FROM nginx:1.26-alpine-otel
EXPOSE 80
COPY --from=0 ./dist /var/www/memoires-info/html
COPY .env /var/www/memoires-info/html/.env
COPY --from=0 ../dist /var/www/memoires-info/html
COPY ../.env /var/www/memoires-info/html/.env

# copy the nginx config
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY ../nginx.conf /etc/nginx/conf.d/default.conf
RUN sed -i '/location \/adminer\//,/}/d' /etc/nginx/conf.d/default.conf
# copy php files for ngnix to know they exist
COPY login/public /var/www/memoires-info/php/public
COPY ../php/public /var/www/memoires-info/php/public

13 changes: 13 additions & 0 deletions Dockerfile/Dockerfile.Php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# php 8.3 with the files, install dependencies
FROM composer:2.7
COPY ../php .
RUN composer install

# copy required files to new image
FROM php:8.3-fpm-alpine
COPY ../php/public /var/www/memoires-info/php/public
COPY ../php/private /var/www/memoires-info/php/private
COPY ../php/lib.php /var/www/memoires-info/php
COPY ../.env /var/www/memoires-info/php/
COPY --from=0 ../app/vendor /var/www/memoires-info/php/vendor

File renamed without changes.
6 changes: 3 additions & 3 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
migration:
build:
context: .
dockerfile: Dockerfile.Sqitch
dockerfile: Dockerfile/Dockerfile.Sqitch
image: sqitch-memoires-info
environment:
SQITCH_TARGET: "db:pg://postgres:${POSTGRES_PASSWORD}@db:5432/memoires-info"
Expand All @@ -53,15 +53,15 @@ services:
php:
build:
context: .
dockerfile: Dockerfile.Php
dockerfile: Dockerfile/Dockerfile.Php
image: php-memoires-info
depends_on:
- postg-rest

web:
build:
context: .
dockerfile: Dockerfile.Nginx
dockerfile: Dockerfile/Dockerfile.Nginx
image: nginx-memoires-info
ports:
- '80:80'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions php/public/esp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/../private/esp.php';
2 changes: 2 additions & 0 deletions php/public/login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
require_once __DIR__ . '/../private/login.php';

0 comments on commit 3148fca

Please sign in to comment.