Commit dec93673 authored by Jacob Priddy's avatar Jacob Priddy 👌

Add stuff for production

parent 42f65df0
Pipeline #9732 passed with stages
in 2 minutes and 58 seconds
......@@ -75,7 +75,7 @@ services:
api:
build:
context: .
dockerfile: Dockerfile
dockerfile: dev.Dockerfile
container_name: api
volumes:
- ./src:/var/www
......
version: '3.7'
networks:
doorcode:
driver: bridge
secrets:
webserver_cert:
file: ./secrets/certs/webserver.cert
webserver_key:
file: ./secrets/certs/webserver.key
root_cert:
file: ./secrets/certs/root.cert
postgres_password:
file: ./secrets/passwords/postgres
volumes:
db-data:
services:
webserver:
image: nginx:1-alpine
container_name: webserver
restart: always
tty: true
secrets:
- webserver_cert
- webserver_key
- root_cert
ports:
- "443:443"
volumes:
- ./src:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d
- ./nginx/dhparam/:/run/dhparam
# Saml config
- ./simplesamlphp-1.18.5:/var/simplesamlphp
- ./simple-saml/cert:/var/simplesamlphp/cert
- ./simple-saml/config:/var/simplesamlphp/config
- ./simple-saml/metadata:/var/simplesamlphp/metadata
- ./simplesamlphp-1.18.5:/var/simplesamlphp-idp
- ./simple-saml-idp/cert:/var/simplesamlphp-idp/cert
- ./simple-saml-idp/config:/var/simplesamlphp-idp/config
- ./simple-saml-idp/metadata:/var/simplesamlphp-idp/metadata
networks:
- doorcode
postgres:
image: postgres:11-alpine
container_name: postgres
restart: always
tty: true
ports:
- "5432:5432"
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: web
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
POSTGRES_DB: doorcode
networks:
- doorcode
dbadmin:
image: dockage/phppgadmin:latest
container_name: dbadmin
restart: always
tty: true
ports:
- "127.0.0.1:80:80"
depends_on:
- postgres
environment:
PHP_PG_ADMIN_SERVER_HOST: postgres
PHP_PG_ADMIN_SERVER_DEFAULT_DB: doorcode
PHP_PG_ADMIN_SERVER_PORT: 5432
networks:
- doorcode
api:
build:
context: .
dockerfile: prod.Dockerfile
container_name: api
restart: always
volumes:
- ./src:/var/www
- ./php/prod.ini:/usr/local/etc/php/conf.d/local.ini
# Map saml files to the php-fpm server so it has access to them as well
- ./simplesamlphp-1.18.5:/var/simplesamlphp
- ./simple-saml/cert:/var/simplesamlphp/cert
- ./simple-saml/config:/var/simplesamlphp/config
- ./simple-saml/metadata:/var/simplesamlphp/metadata
- ./simplesamlphp-1.18.5:/var/simplesamlphp-idp
- ./simple-saml-idp/cert:/var/simplesamlphp-idp/cert
- ./simple-saml-idp/config:/var/simplesamlphp-idp/config
- ./simple-saml-idp/metadata:/var/simplesamlphp-idp/metadata
networks:
- doorcode
......@@ -10,3 +10,5 @@ xdebug.remote_autostart=1
xdebug.remote.host=host.docker.internal
xdebug.remote.mode=req
xdebug.remote.handler=dbgp
date.timezone = "America/Los_Angeles"
date.timezone = "America/Los_Angeles"
FROM php:7.4-fpm-alpine
ENV PROJECT_DIR /var/www
# Set working directory
WORKDIR ${PROJECT_DIR}
# Install dependencies
RUN apk update && apk add --no-cache \
alpine-sdk \
postgresql-dev \
zlib-dev \
libpng-dev \
shadow \
bash \
bash-completion \
vim
# Install PHP Extensions
RUN docker-php-ext-install pdo \
pdo_pgsql \
bcmath \
fileinfo \
gd
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Add user for application and create source directories
RUN groupadd -g 1000 www && \
useradd -u 1000 -ms /bin/bash -g www www
# Copy existing application directory permissions
COPY --chown=root:www src/ ${WORKDIR}
COPY php/prod.ini /usr/local/etc/php/conf.d/local.ini
# Change current user to www
USER www
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
*
!.gitignore
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment