Skip to content

Instantly share code, notes, and snippets.

@ibraah88
Forked from kyleferguson/Dockerfile
Created January 10, 2019 14:41
Show Gist options
  • Save ibraah88/2655223d322648f1ee12d06c5a25c7e6 to your computer and use it in GitHub Desktop.
Save ibraah88/2655223d322648f1ee12d06c5a25c7e6 to your computer and use it in GitHub Desktop.
Example Laravel deployment for Kubernetes
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: platform-api
spec:
replicas: 3
selector:
matchLabels:
app: platform-api
template:
metadata:
labels:
app: platform-api
commit: [INSERTED_DURING_CI]
spec:
containers:
- name: app
image: us.gcr.io/nexmillio/platform-api:latest
imagePullPolicy: Always
ports:
- {containerPort: 80}
env:
- { name: "APP_ENV", value: "production" }
- { name: "APP_DEBUG", value: "false" }
- { name: "APP_KEY", valueFrom: { secretKeyRef: { name: platform-api-secrets, key: app.key }} }
- { name: "APP_TIMEZONE", value: "UTC" }
- { name: "HASH_ID_SECRET", valueFrom: { secretKeyRef: { name: platform-api-secrets, key: hash.id.secret }} }
livenessProbe:
httpGet:
path: /healthz
port: 80
initialDelaySeconds: 10
timeoutSeconds: 3
FROM php:7.1-apache
ADD . /var/www
ADD ./site.conf /etc/apache2/sites-enabled/000-default.conf
RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client && \
docker-php-ext-install mcrypt pdo_mysql opcache && \
pecl install redis-3.1.2 && docker-php-ext-enable redis && \
a2enmod rewrite
WORKDIR /var/www
apiVersion: v1
kind: Secret
metadata:
name: platform-api-secrets
data:
app.key: [BASE64_VALUE]
hash.id.secret: [BASE64_VALUE]
db.password: [BASE64_VALUE]
apiVersion: v1
kind: Service
metadata:
name: platform-api
spec:
selector:
app: platform-api
ports:
- protocol: TCP
port: 80
type: NodePort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment