Skip to content

Commit

Permalink
Add docker dev environment (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev authored Feb 22, 2024
1 parent eb03151 commit 5a69be2
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 25 deletions.
22 changes: 22 additions & 0 deletions .docker/php/php81/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ----------------------
# The FPM base container
# ----------------------
FROM php:8.1-cli-alpine AS dev

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS

# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*

# ----------------------
# Composer install step
# ----------------------

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# ----------------------
# The FPM production container
# ----------------------
FROM dev
22 changes: 22 additions & 0 deletions .docker/php/php82/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ----------------------
# The FPM base container
# ----------------------
FROM php:8.2-cli-alpine AS dev

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS

# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*

# ----------------------
# Composer install step
# ----------------------

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# ----------------------
# The FPM production container
# ----------------------
FROM dev
22 changes: 22 additions & 0 deletions .docker/php/php83/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ----------------------
# The FPM base container
# ----------------------
FROM php:8.3-cli-alpine AS dev

RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS

# Cleanup apk cache and temp files
RUN rm -rf /var/cache/apk/* /tmp/*

# ----------------------
# Composer install step
# ----------------------

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# ----------------------
# The FPM production container
# ----------------------
FROM dev
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
* text=auto

/.docker export-ignore
/.github export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/phpunit.xml.dist export-ignore
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: tests

on: [ push, pull_request ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.1, 8.2, 8.3 ]
dependency-version: [ prefer-lowest, prefer-stable ]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring
tools: composer:v2
coverage: none

- name: Install dependencies
run: |
composer install --no-interaction
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit --testdox
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020, Anton Komarev <[email protected]>
Copyright (c) 2024, Anton Komarev <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"docs": "https://github.com/cybercog/youtrack-rest-php/wiki"
},
"require": {
"php": "^7.1|^8.0",
"php": "^8.0",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.2"
},
Expand Down
34 changes: 34 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.9"
services:
php81:
container_name: php-youtrack-rest-81
image: php-youtrack-rest
build:
context: ./
dockerfile: ./.docker/php/php81/Dockerfile
tty: true
working_dir: /app
volumes:
- ./:/app

php82:
container_name: php-youtrack-rest-82
image: php-youtrack-rest
build:
context: ./
dockerfile: ./.docker/php/php82/Dockerfile
tty: true
working_dir: /app
volumes:
- ./:/app

php83:
container_name: php-youtrack-rest-83
image: php-youtrack-rest
build:
context: ./
dockerfile: ./.docker/php/php83/Dockerfile
tty: true
working_dir: /app
volumes:
- ./:/app

0 comments on commit 5a69be2

Please sign in to comment.