Skip to content

Commit

Permalink
Merge pull request #38 from oroneta/fix_from_server
Browse files Browse the repository at this point in the history
hotfix
  • Loading branch information
ZhengLinLei authored May 9, 2024
2 parents 52cc6bf + 0d0b35a commit 2c7359a
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ DB_PORT = 5432
PUBLIC_URL = /


SERVER_ENV = pro # Or set to pro
SERVER_ENV = dev # [ pro, dev, build ]
5 changes: 3 additions & 2 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ services:
context: ..
dockerfile: ./docker/www/${SERVER_ENV}/Dockerfile
ports:
- "80:80"
- "80:3000"
env_file:
- .env
stdin_open: true
depends_on:
- oroneta.drone-front.db
volumes:
Expand All @@ -44,7 +45,7 @@ services:
depends_on:
- oroneta.drone-front.db
ports:
- "8081:80"
- "8082:80"
environment:
# PMA_HOST: ${DB_HOST}
PMA_HOST: ${DB_HOST}
Expand Down
59 changes: 59 additions & 0 deletions docker/www/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Build React Website
# FROM node:20.11.1 as build

# WORKDIR /app

# # Solve Error: error:0308010C:digital envelope routines::unsupported
# # https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
# ENV NODE_OPTIONS="--openssl-legacy-provider --max-old-space-size=4096"

# # Copy source to build
# COPY ./src ./

# # Install all dependencies
# RUN npm install
# RUN npm run build


# # ---------------------------------


# Production
FROM php:8.0.0-apache
ARG DEBIAN_FRONTEND=noninteractive

WORKDIR /var/www/html

# Remove old
RUN rm -rf ./*

# Copy from react buld to production server
COPY ./src/build /var/www/html

# COPY ./www .

RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql

# Include alternative DB driver
# RUN docker-php-ext-install mysqli


RUN apt-get update \
&& apt-get install -y sendmail libpng-dev \
&& apt-get install -y libzip-dev \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libonig-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install zip





RUN docker-php-ext-install mbstring
RUN docker-php-ext-install zip
RUN docker-php-ext-install gd

RUN a2enmod rewrite

1 change: 1 addition & 0 deletions docker/www/build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Get build files from local, instead building inside docker
38 changes: 11 additions & 27 deletions docker/www/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
# Build React Website
FROM node:20.11.1 as build

# Dev pre-production
FROM php:8.0.0-apache
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /app

WORKDIR /var/www/html
# Solve Error: error:0308010C:digital envelope routines::unsupported
# https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
ENV NODE_OPTIONS="--openssl-legacy-provider --max-old-space-size=4096"

# Copy source to build
COPY ./src ./

RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql

# Include alternative DB driver
# RUN docker-php-ext-install mysqli


RUN apt-get update \
&& apt-get install -y sendmail libpng-dev \
&& apt-get install -y libzip-dev \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libonig-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install zip



RUN docker-php-ext-install mbstring
RUN docker-php-ext-install zip
RUN docker-php-ext-install gd

RUN a2enmod rewrite

# Install all dependencies
RUN npm install
CMD ["npm", "run", "start", "&&", "tail", "-f", "/dev/null"]
2 changes: 1 addition & 1 deletion docker/www/pro/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /app

# Solve Error: error:0308010C:digital envelope routines::unsupported
# https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
ENV NODE_OPTIONS=--openssl-legacy-provider
ENV NODE_OPTIONS="--openssl-legacy-provider --max-old-space-size=4096"

# Copy source to build
COPY ./src ./
Expand Down
1 change: 1 addition & 0 deletions src/src/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store

0 comments on commit 2c7359a

Please # to comment.