File tree 14 files changed +367
-31
lines changed
14 files changed +367
-31
lines changed Original file line number Diff line number Diff line change
1
+ /node_modules
2
+ /vendor
3
+
4
+ /public /build
5
+ /public /hot
6
+ /public /storage
7
+
8
+ docker-compose.yml
9
+ docker-compose.prod.yml
10
+ docker-compose.actions.yml
Original file line number Diff line number Diff line change
1
+ APP_PORT=80
2
+ NODE_PORT=5173
3
+ DOCKER_USER=1000:1000
4
+
5
+ STEAM_CLIENT_SECRET=STEAM_API_KEY
6
+ STEAM_REDIRECT_URI="http://localhost/steam/callback"
7
+
8
+ APP_NAME=steam-buddy
9
+ APP_ENV=local
10
+ APP_KEY=
11
+ APP_DEBUG=true
12
+ APP_TIMEZONE=UTC
13
+ APP_URL=http://localhost
14
+
15
+ APP_LOCALE=en
16
+ APP_FALLBACK_LOCALE=en
17
+ APP_FAKER_LOCALE=en_US
18
+
19
+ APP_MAINTENANCE_DRIVER=file
20
+ APP_MAINTENANCE_STORE=database
21
+
22
+ BCRYPT_ROUNDS=12
23
+
24
+ LOG_CHANNEL=stack
25
+ LOG_STACK=single
26
+ LOG_DEPRECATIONS_CHANNEL=null
27
+ LOG_LEVEL=debug
28
+
29
+ DB_CONNECTION=sqlite
30
+ DB_DATABASE=/app/docker/actions/database.sqlite
31
+
32
+ SESSION_DRIVER=database
33
+ SESSION_LIFETIME=120
34
+ SESSION_ENCRYPT=false
35
+ SESSION_PATH=/
36
+ SESSION_DOMAIN=null
37
+
38
+ BROADCAST_CONNECTION=log
39
+ FILESYSTEM_DISK=local
40
+ QUEUE_CONNECTION=database
41
+
42
+ CACHE_STORE=database
43
+ CACHE_PREFIX=
44
+
45
+ MEMCACHED_HOST=127.0.0.1
46
+
47
+ REDIS_CLIENT=predis
48
+ REDIS_HOST=sb-redis
49
+ REDIS_PASSWORD=password
50
+ REDIS_PORT=6379
51
+
52
+ MAIL_MAILER=log
53
+ MAIL_HOST=127.0.0.1
54
+ MAIL_PORT=2525
55
+ MAIL_USERNAME=null
56
+ MAIL_PASSWORD=null
57
+ MAIL_ENCRYPTION=null
58
+ MAIL_FROM_ADDRESS="
[email protected] "
59
+ MAIL_FROM_NAME="${APP_NAME}"
60
+
61
+ AWS_ACCESS_KEY_ID=
62
+ AWS_SECRET_ACCESS_KEY=
63
+ AWS_DEFAULT_REGION=us-east-1
64
+ AWS_BUCKET=
65
+ AWS_USE_PATH_STYLE_ENDPOINT=false
66
+
67
+ VITE_APP_NAME="${APP_NAME}"
Original file line number Diff line number Diff line change
1
+ name : Docker Image Publish
2
+
3
+ on :
4
+ push :
5
+ branches : [ "main" ]
6
+
7
+ env :
8
+ REGISTRY : ghcr.io
9
+ IMAGE_NAME : ${{ github.repository }}
10
+
11
+ jobs :
12
+ build :
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ -
16
+ name : Checkout
17
+ uses : actions/checkout@v2
18
+ -
19
+ name : Build Docker images
20
+ run : docker compose -f ./docker-compose.prod.yml build
21
+ -
22
+ name : Show result
23
+ run : docker images
24
+ -
25
+ name : Save Docker images to tar
26
+ run : docker save -o image.tar steam-buddy_php:latest
27
+ -
28
+ name : Upload tar artifact
29
+ uses : actions/upload-artifact@v2
30
+ with :
31
+ name : image.tar
32
+ path : image.tar
33
+
34
+ release :
35
+ needs : [build]
36
+ runs-on : ubuntu-latest
37
+ steps :
38
+ -
39
+ name : Download all artifacts
40
+ uses : actions/download-artifact@v2
41
+ -
42
+ name : Display structure of downloaded files
43
+ run : ls -R
44
+ -
45
+ name : Create Release
46
+ id : create_release
47
+ uses : actions/create-release@v1
48
+ env :
49
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50
+ with :
51
+ tag_name : ${{ github.sha }}
52
+ release_name : Steam Buddy ${{ github.sha }}
53
+ draft : true
54
+ prerelease : false'
55
+ -
56
+ name : Upload
57
+ uses : actions/upload-release-asset@v1
58
+ env :
59
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
60
+ with :
61
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
62
+ asset_path : image.tar/image.tar
63
+ asset_name : image.tar
64
+ asset_content_type : application/tar
Original file line number Diff line number Diff line change
1
+ name : Docker Image Publish
2
+
3
+ on :
4
+ pull_request :
5
+ push : { branches: master }
6
+
7
+ env :
8
+ REGISTRY : ghcr.io
9
+ IMAGE_NAME : ${{ github.repository }}
10
+
11
+ jobs :
12
+ test :
13
+ name : Run test suite
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ -
17
+ name : Checkout
18
+ uses : actions/checkout@v2
19
+ -
20
+ name : Start docker
21
+ run : make actions
22
+ -
23
+ name : Run backend tests
24
+ run : docker compose exec action composer test
25
+ -
26
+ name : Run frontend tests
27
+ run : docker compose exec action npm run test
Original file line number Diff line number Diff line change @@ -7,9 +7,13 @@ check-env-file:
7
7
exit 1; \
8
8
fi ; \
9
9
10
- run :
11
- @docker compose up -d
12
- @docker compose exec node npm run build
10
+ actions :
11
+ @docker compose -f ./docker-compose.actions.yml up -d
12
+ @docker compose -f ./docker-compose.actions.yml exec -it action bash /app/docker/actions/init.sh
13
+
14
+ prod :
15
+ @docker compose -f ./docker-compose.prod.yml up -d
16
+ @docker compose -f ./docker-compose.prod.yml exec -it php bash
13
17
14
18
dev :
15
19
@docker compose up -d
Original file line number Diff line number Diff line change
1
+ version : ' 3.8'
2
+ services :
3
+ action :
4
+ container_name : sb-action
5
+ working_dir : /app
6
+ user : $DOCKER_USER
7
+ tty : true
8
+ build :
9
+ context : .
10
+ dockerfile : ./docker/actions/Dockerfile
11
+ volumes :
12
+ - .:/app
13
+ - ./docker/actions/database.sqlite:/app/database.sqlite
Original file line number Diff line number Diff line change 1
- # todo
1
+ version : ' 3.8'
2
+ services :
3
+ web :
4
+ image : nginx:1.25.3-alpine
5
+ container_name : sb-web
6
+ working_dir : /app
7
+ volumes :
8
+ - ./docker/production/nginx/config.conf:/etc/nginx/conf.d/default.conf
9
+ - app_files:/app
10
+ networks :
11
+ - app-net
12
+ ports :
13
+ - $APP_PORT:80
14
+ depends_on :
15
+ - php
16
+
17
+ php :
18
+ container_name : sb-php
19
+ working_dir : /app
20
+ user : $DOCKER_USER
21
+ volumes :
22
+ - app_files:/app
23
+ - ./.env:/app/.env
24
+ image : steam-buddy_php
25
+ build :
26
+ context : .
27
+ dockerfile : ./docker/production/php/Dockerfile
28
+ networks :
29
+ - app-net
30
+ depends_on :
31
+ database :
32
+ condition : service_healthy
33
+ redis :
34
+ condition : service_healthy
35
+
36
+ database :
37
+ container_name : sb-database
38
+ working_dir : /app
39
+ image : postgres:16.1-alpine3.19
40
+ environment :
41
+ POSTGRES_DB : ${DB_DATABASE}
42
+ POSTGRES_USER : ${DB_USERNAME}
43
+ POSTGRES_PASSWORD : ${DB_PASSWORD}
44
+ volumes :
45
+ - db_data:/var/lib/postgresql/data
46
+ networks :
47
+ - app-net
48
+ healthcheck :
49
+ test : ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"]
50
+ interval : 5s
51
+ timeout : 5s
52
+ retries : 5
53
+
54
+ redis :
55
+ image : redis:7.2.3-alpine
56
+ container_name : sb-redis
57
+ command : redis-server --appendonly yes --requirepass "${REDIS_PASSWORD}"
58
+ networks :
59
+ - app-net
60
+ volumes :
61
+ - redis_data:/data
62
+ healthcheck :
63
+ test : ["CMD", "redis-cli","ping"]
64
+ interval : 5s
65
+ timeout : 5s
66
+ retries : 5
67
+
68
+ networks :
69
+ app-net :
70
+ driver : bridge
71
+
72
+ volumes :
73
+ app_files :
74
+ db_data :
75
+ redis_data :
Original file line number Diff line number Diff line change
1
+ FROM php:8.2-alpine3.16
2
+
3
+ COPY --from=composer/composer:2.4.4 /usr/bin/composer /usr/bin/composer
4
+
5
+ RUN apk update
6
+ RUN apk --no-cache add bash zip git libzip-dev libpng-dev libpq-dev nodejs-current npm bash
7
+
8
+ RUN docker-php-ext-install zip gd
9
+ RUN docker-php-ext-configure zip
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ cp /app/.env.actions /app/.env
4
+
5
+ composer install
6
+
7
+ npm install
8
+ npm run build
9
+
10
+ php artisan key:generate
11
+ php artisan migrate
12
+ php artisan cache:clear
13
+ php artisan config:clear
14
+
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 80 default;
3
+ server_name localhost;
4
+ root /app/public;
5
+
6
+ access_log /dev/stdout;
7
+
8
+ index index.php;
9
+
10
+ if (!-e $request_filename) {
11
+ rewrite ^.*$ /index.php last;
12
+ }
13
+
14
+ location ~ \.php$ {
15
+ fastcgi_pass sb-php:9000;
16
+ fastcgi_index index.php;
17
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
18
+ fastcgi_param PHP_VALUE "error_log=/dev/stdout";
19
+ fastcgi_buffers 16 16k;
20
+ fastcgi_buffer_size 32k;
21
+ include fastcgi_params;
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ FROM node:20-alpine AS frontend
2
+
3
+ RUN apk update
4
+ RUN apk --no-cache add bash git
5
+
6
+ COPY . /app
7
+ WORKDIR /app
8
+ RUN npm install
9
+ RUN npm run build
10
+
11
+ ENTRYPOINT ["docker-entrypoint.sh" ]
12
+
13
+ FROM php:8.2-fpm-alpine3.16
14
+
15
+ COPY --from=composer/composer:2.4.4 /usr/bin/composer /usr/bin/composer
16
+
17
+ RUN apk update
18
+ RUN apk --no-cache add bash zip git libzip-dev libpng-dev libpq-dev
19
+
20
+ RUN docker-php-ext-install zip gd pdo pdo_pgsql
21
+ RUN docker-php-ext-configure zip
22
+
23
+ COPY . /app
24
+ RUN rm -rf /app/public
25
+ COPY --from=frontend /app/public /app/public
26
+
27
+ WORKDIR /app
28
+
29
+ RUN composer install
30
+ RUN chown -R www-data:www-data /app/storage
31
+
32
+ ENTRYPOINT ["php-fpm" ]
You can’t perform that action at this time.
0 commit comments