Skip to content

Instantly share code, notes, and snippets.

View dkarlovi's full-sized avatar
🖌️
Moving bytes around.

Dalibor Karlović dkarlovi

🖌️
Moving bytes around.
View GitHub Profile
@dkarlovi
dkarlovi / Dockerfile
Created December 7, 2021 12:58
Symfony + Encore in one Dockerfile
# syntax=docker/dockerfile:1.2
ARG BASE_DOCKER_IMAGE
ARG NODE_DOCKER_IMAGE
FROM ${NODE_DOCKER_IMAGE} AS node-builder
WORKDIR /app
COPY assets /app/assets
COPY package.json tsconfig.json webpack.config.js yarn.lock /app/
RUN --mount=type=cache,target=/yarn yarn install --frozen-lockfile --cache-dir=/yarn
RUN --mount=type=cache,target=/yarn yarn encore production
@dkarlovi
dkarlovi / Dockerfile
Created October 15, 2021 10:35
Example of using libfaketime with PHP in Docker
FROM php:8.0-alpine
COPY --from=trajano/alpine-libfaketime /faketime.so /lib/faketime.so
ENV LD_PRELOAD=/lib/faketime.so
@dkarlovi
dkarlovi / Exporter.php
Created April 8, 2021 10:53
Zipkin exporter decoupled from Guzzle
<?php
declare(strict_types=1);
namespace OpenTelemetry\Contrib\Zipkin;
use InvalidArgumentException;
use OpenTelemetry\Sdk\Trace;
use OpenTelemetry\Trace as API;
use Psr\Http\Client\ClientExceptionInterface;
@dkarlovi
dkarlovi / mkcert
Last active July 4, 2020 10:12
/etc/sudoers.d/mkcert
dalibor.karlovic ALL=/usr/bin/tee /etc/pki/ca-trust/source/anchors/mkcert_development_CA*, /usr/bin/rm -f /etc/pki/ca-trust/source/anchors/mkcert_development_CA*, /usr/bin/update-ca-trust extract

Test

Pushing to this gist via Git repo

@dkarlovi
dkarlovi / Dockerfile
Last active March 18, 2020 07:45
Symfony + RoadRunner + build-time cache volume Dockerfile
# syntax=docker/dockerfile:experimental
FROM alpine:3.11 AS runtime
WORKDIR /app
RUN addgroup -g 82 -S www-data && \
adduser -u 82 -H -D -S -G www-data www-data && \
apk add --update --no-cache \
php7 \
php7-ctype \
php7-dom \
php7-iconv \
@dkarlovi
dkarlovi / README.md
Last active March 9, 2020 23:42
Split a large XML file into several smaller XML files

How to run

saxon -s:in.xml -xsl:split.xsl name=Products size=1200
@dkarlovi
dkarlovi / qa.Dockerfile
Created January 30, 2019 10:56
QA Dockerfile
ARG BUILD_VERSION
FROM example.com/app:${BUILD_VERSION}
# copy QA tools from a known source
COPY --from=jakzal/phpqa:alpine /tools /tools/
COPY --from=jakzal/phpqa:alpine /usr/bin/composer /tools/
RUN apk add --update --no-cache \
curl \
openssl \
@dkarlovi
dkarlovi / Dockerfile
Last active April 6, 2023 08:38
Setting up permissions for a (Symfony) web app on Docker
FROM alpine:3.7
# this is the "app" image, contains PHP-FPM
RUN addgroup -g 82 -S www-data && \
adduser -u 82 -H -D -S -G www-data www-data && \
# etc..
# PHP-FPM is setup to run as "www-data"
WORKDIR /app
@dkarlovi
dkarlovi / registry.example.com.conf
Last active February 7, 2024 19:38
GitLab's Container Registry (docker) behind Apache 2.4 reverse proxy
<VirtualHost *:80>
ServerName registry.example.com
ServerSignature Off
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [NE,R,L]
</VirtualHost>
<VirtualHost *:443>