This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
if [ ${APP_ENV} = 'local' ]; | |
then | |
echo "not in production" | |
cd /src && air | |
else | |
echo "in production" | |
(cd /src/) && (go build main.go) && (/src/./main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.16-alpine as build | |
RUN apk add --no-cache git | |
RUN go get -v github.com/cosmtrek/air | |
WORKDIR /src | |
COPY . /src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:stretch | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
curl \ | |
wget \ | |
zip \ | |
git \ | |
unzip && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
apt-get clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: mongo-express-deployment | |
labels: | |
app: mongo-express | |
spec: | |
replicas: 2 | |
selector: | |
matchLabels: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start octane in production if DOCKER_APP_ENV is not development | |
if [ ${DOCKER_APP_ENV} = 'development' ]; | |
then | |
echo "Octane is not ready" | |
php /var/www/html/artisan serve | |
else | |
echo "Octane is ready" | |
php /var/www/html/artisan octane:start | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
app: | |
image: app | |
build: | |
context: . | |
dockerfile: ./docker/Dockerfile | |
args: | |
- PHP_VERSION=${PHP_VERSION:-7.4} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# user www-data; | |
worker_processes auto; | |
pid /run/nginx.pid; | |
include /etc/nginx/modules-enabled/*.conf; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# Set the port to listen on and the server name | |
listen 80; | |
# Set the document root of the project | |
root /var/www/app/public; | |
# Set the directory index files | |
index index.php index.html index.htm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fields := reflect.VisibleFields(reflect.TypeOf(struct{ employeeDetails }{})) | |
for _, field := range fields { | |
fmt.Printf("Key: %s\tType: %s\n", field.Name, field.Type) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getAttr(obj interface{}, fieldName string) reflect.Value { | |
pointToStruct := reflect.ValueOf(obj) // addressable | |
curStruct := pointToStruct.Elem() | |
if curStruct.Kind() != reflect.Struct { | |
panic("not struct") | |
} | |
curField := curStruct.FieldByName(fieldName) // type: reflect.Value | |
if !curField.IsValid() { | |
panic("not found:" + fieldName) | |
} |