GithubHelp home page GithubHelp logo

miguelangelopereira / alpine-apache-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wichon/alpine-apache-php

0.0 1.0 0.0 10 KB

A simple and slim apache/php docker image using Alpine Linux

License: MIT License

Dockerfile 27.62% Shell 72.38%

alpine-apache-php's Introduction

alpine-apache-php

A simple and slim apache/php docker image using Alpine Linux

Build

docker build --no-cache -t [image-name]:latest .

Usage

Environment Variables

WEBAPP_ROOT

Specify the web app root to a folder inside your website code, for example: public/.

WEBAPP_USER_ID

Specify the user id which apache will use to execute its child processes, useful for development mode.

LOG_CONF

Controls log files redirection.

Log Files Redirection

Log files can now be redirected to STDOUT and STDERR if needed, can be customized to redirect only access logs or only error logs, both or none.

This can be done by setting the LOG_CONF environment variable, the supported values are:

Value Behavior
all Redirect access and error logs to STDOUT and STDERR respectively
access Redirect access logs to STDOUT, error logs are kept inside the container
error Redirect error logs to STDERR, access logs are kept inside the container
none or empty or any other value Don't redirect any log, logs are kept inside the container

Development mode

Development mode will let you mount a folder containing your website inside the container, and be able to do live changes to code while the container is running, in order for this to work the WEBAPP_USER_ID env variable most be set to the user owning that folder (id -u will return that id in linux).

docker run --name=webapp -v /path/to/webapp:/app -e WEBAPP_USER_ID=$(id -u) -p 80:80 [image-name]:latest

The document root can be customized by using an env variable WEBAPP_ROOT to specify a subfolder containing the document app root.

docker run --name=webapp -e "WEBAPP_ROOT=[Web app root if any, ex. public/]" -v /path/to/webapp:/app -e WEBAPP_USER_ID=$(id -u) -p 80:80 [image-name]:latest

Tested only in linux, user permissions may not work in windows envs.

Production mode

Build a new docker container using this one as base and copy the contents of your web site:

FROM wichon/alpine-apache-php:latest

COPY . /app

Notes

In development mode, this container will change the ownership of all your files inside /path/to/webapp to the user id running the container.

alpine-apache-php's People

Contributors

wichon avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.