Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
[AWSRESET-313]: workflow updated
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-dvsa committed Oct 17, 2023
1 parent cdb33d9 commit b93c351
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 23 deletions.
44 changes: 21 additions & 23 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
ARG DVSA_AWS_SHAREDCOREECR_ID

# hadolint ignore=DL3006
FROM ${DVSA_AWS_SHAREDCOREECR_ID}.dkr.ecr.eu-west-1.amazonaws.com/php-base:7.4.0-alpine-fpm-8b0b625
FROM 245185850403.dkr.ecr.eu-west-1.amazonaws.com/php-base:7.4.0-alpine-fpm-8b0b625

LABEL maintainer="[email protected]"
LABEL description="PHP Alpine base image with dependency packages"
LABEL Name="vol-php-fpm:7.4.33-alpine-fpm"
LABEL Version="0.1"

# FROM registry.olcs.dev-dvsacloud.uk/k8s/php:7.4.22-fpm-alpine as intermediate
# Expose ports
EXPOSE 80


ADD backend.tar.gz /opt/dvsa/olcs-backend
RUN apk -U upgrade && apk add --no-cache \
curl \
nginx


#RUN rm /etc/nginx/conf.d/default.conf

COPY nginx/conf.d/backend.conf /etc/nginx/nginx.conf

# FROM registry.olcs.dev-dvsacloud.uk/k8s/php:7.4.22-fpm-alpine as intermediate

RUN mkdir -p /opt/dvsa/olcs-backend /var/log/dvsa /tmp/Entity/Proxy && \
touch /var/log/dvsa/backend.log

ADD backend.tar.gz /opt/dvsa/olcs-backend

COPY start.sh /start.sh
RUN chmod +x /start.sh

# RUN apk add g++ git icu-dev zlib-dev libzip-dev && docker-php-ext-install intl zip && \
# curl -sS "https://getcomposer.org/installer" -x "${http_proxy}" -o composer-setup.php && \
# php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
# php composer-setup.php --version=1.10.6 && php -r "unlink('composer-setup.php');" && \
# php composer.phar install --optimize-autoloader --no-interaction --no-dev

# FROM registry.olcs.dev-dvsacloud.uk/k8s/php-baseline:7.4.22-fpm-alpine

# Tweak redis extension settings
RUN echo 'session.save_handler = redis' >> /usr/local/etc/php/conf.d/50-docker-php-ext-redis.ini && \
echo 'session.save_path = "tcp://redis-master"' >> /usr/local/etc/php/conf.d/50-docker-php-ext-redis.ini



# COPY --from=intermediate /build/config /opt/dvsa/olcs-backend/config
# COPY --from=intermediate /build/vendor /opt/dvsa/olcs-backend/vendor
# COPY --from=intermediate /build/module /opt/dvsa/olcs-backend/module
# COPY --from=intermediate /build/public /opt/dvsa/olcs-backend/public
# COPY --from=intermediate /build/data /opt/dvsa/olcs-backend/data
# COPY --from=intermediate /build/init_autoloader.php /opt/dvsa/olcs-backend/init_autoloader.php
#RUN echo 'session.save_handler = redis' >> /usr/local/etc/php/conf.d/50-docker-php-ext-redis.ini && \
#echo 'session.save_path = "tcp://redis-master"' >> /usr/local/etc/php/conf.d/50-docker-php-ext-redis.ini

RUN rm -f /opt/dvsa/olcs-backend/config/autoload/local* && \
chown -R www-data:www-data /opt/dvsa /tmp/Entity /var/log/dvsa

USER www-data
#USER www-data

CMD ["/usr/local/sbin/php-fpm", "-F"]
CMD ["/start.sh"]



43 changes: 43 additions & 0 deletions nginx/conf.d/backend.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;

root /opt/dvsa/olcs-backend/public;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
include fastcgi_params;

fastcgi_param PHP_VALUE "include_path=.:/usr/local/lib/php; include_path=/var/www/laminas/module/Application;";

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}


# Include additional configuration files for virtual hosts or other custom configurations.
include /etc/nginx/conf.d/*.conf;
}
7 changes: 7 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Start PHP-FPM
/usr/local/sbin/php-fpm -F --nodaemonize &

# Start Nginx
nginx -g 'daemon off;'

0 comments on commit b93c351

Please sign in to comment.