Skip to content

Commit 1fb686e

Browse files
committed
fix docker config
1 parent 700b027 commit 1fb686e

11 files changed

+140
-58
lines changed

.dockerignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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

.env.actions

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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=pgsql
30+
DB_HOST=sb-database
31+
DB_PORT=5432
32+
DB_DATABASE=steam_buddy
33+
DB_USERNAME=postgres
34+
DB_PASSWORD=password
35+
36+
SESSION_DRIVER=redis
37+
SESSION_LIFETIME=120
38+
SESSION_ENCRYPT=false
39+
SESSION_PATH=/
40+
SESSION_DOMAIN=null
41+
42+
BROADCAST_CONNECTION=log
43+
FILESYSTEM_DISK=local
44+
QUEUE_CONNECTION=redis
45+
46+
CACHE_STORE=redis
47+
CACHE_PREFIX=
48+
49+
MEMCACHED_HOST=127.0.0.1
50+
51+
REDIS_CLIENT=predis
52+
REDIS_HOST=sb-redis
53+
REDIS_PASSWORD=password
54+
REDIS_PORT=6379
55+
56+
MAIL_MAILER=log
57+
MAIL_HOST=127.0.0.1
58+
MAIL_PORT=2525
59+
MAIL_USERNAME=null
60+
MAIL_PASSWORD=null
61+
MAIL_ENCRYPTION=null
62+
MAIL_FROM_ADDRESS="[email protected]"
63+
MAIL_FROM_NAME="${APP_NAME}"
64+
65+
AWS_ACCESS_KEY_ID=
66+
AWS_SECRET_ACCESS_KEY=
67+
AWS_DEFAULT_REGION=us-east-1
68+
AWS_BUCKET=
69+
AWS_USE_PATH_STYLE_ENDPOINT=false
70+
71+
VITE_APP_NAME="${APP_NAME}"

.github/workflows/docker-publish.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
run: docker images
2424
-
2525
name: Save Docker images to tar
26-
run: docker save -o images.tar steam-buddy_php:latest steam-buddy_node:latest
26+
run: docker save -o image.tar steam-buddy_php:latest
2727
-
2828
name: Upload tar artifact
2929
uses: actions/upload-artifact@v2
3030
with:
31-
name: images.tar
32-
path: images.tar
31+
name: image.tar
32+
path: image.tar
3333

3434
release:
3535
needs: [build]
@@ -59,6 +59,6 @@ jobs:
5959
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060
with:
6161
upload_url: ${{ steps.create_release.outputs.upload_url }}
62-
asset_path: images.tar/images.tar
63-
asset_name: images.tar
62+
asset_path: image.tar/image.tar
63+
asset_name: image.tar
6464
asset_content_type: application/tar

.github/workflows/run-tests.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,9 @@ jobs:
1616
-
1717
name: Checkout
1818
uses: actions/checkout@v2
19-
-
20-
name: Create .env
21-
run: cp .env.example .env
22-
-
23-
name: Build docker
24-
run: docker compose -f ./docker-compose.actions.yml build
2519
-
2620
name: Start docker
27-
run: docker compose -f ./docker-compose.actions.yml up -d
21+
run: make actions
2822
-
2923
name: Run backend tests
3024
run: docker compose exec php composer test

Makefile

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ check-env-file:
77
exit 1;\
88
fi; \
99

10-
build:
11-
@docker-compose down
12-
@docker-compose -f ./docker-compose.prod.yml build
13-
@docker-compose -f ./docker-compose.prod.yml up -d
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
1417

1518
dev:
1619
@docker compose up -d

docker-compose.actions.yml

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
version: '3.8'
22
services:
3-
php:
4-
container_name: sb-php
3+
action:
4+
container_name: sb-action
55
working_dir: /app
66
user: $DOCKER_USER
7-
image: steam-buddy_php
87
tty: true
98
build:
109
context: .
11-
dockerfile: ./docker/production/php/Dockerfile
12-
13-
node:
14-
image: steam-buddy_node
15-
build:
16-
context: .
17-
dockerfile: ./docker/production/node/Dockerfile
18-
container_name: sb-node
19-
working_dir: /app
20-
user: $DOCKER_USER
21-
tty: true
22-
10+
dockerfile: ./docker/actions/Dockerfile
11+
volumes:
12+
- .:/app
13+
- ./docker/actions/database.sqlite:/app/database.sqlite

docker-compose.prod.yml

+1-16
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ services:
2020
user: $DOCKER_USER
2121
volumes:
2222
- app_files:/app
23+
- ./.env:/app/.env
2324
image: steam-buddy_php
2425
build:
2526
context: .
@@ -64,22 +65,6 @@ services:
6465
timeout: 5s
6566
retries: 5
6667

67-
node:
68-
image: steam-buddy_node
69-
build:
70-
context: .
71-
dockerfile: ./docker/production/node/Dockerfile
72-
container_name: sb-node
73-
working_dir: /app
74-
user: $DOCKER_USER
75-
tty: true
76-
ports:
77-
- $NODE_PORT:$NODE_PORT
78-
volumes:
79-
- app_files:/app
80-
networks:
81-
- app-net
82-
8368
networks:
8469
app-net:
8570
driver: bridge

docker/actions/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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

docker/actions/init.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
cp /app/.env.actions /app/.env
4+
echo " " > /app/database.sqlite
5+
6+
composer install
7+
8+
npm install
9+
npm run build
10+
11+
php artisan key:generate
12+
php artisan migrate
13+
php artisan cache:clear
14+
php artisan config:clear
15+

docker/production/node/Dockerfile

-11
This file was deleted.

docker/production/php/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
113
FROM php:8.2-fpm-alpine3.16
214

315
COPY --from=composer/composer:2.4.4 /usr/bin/composer /usr/bin/composer
@@ -9,6 +21,9 @@ RUN docker-php-ext-install zip gd pdo pdo_pgsql
921
RUN docker-php-ext-configure zip
1022

1123
COPY . /app
24+
RUN rm -rf /app/public
25+
COPY --from=frontend /app/public /app/public
26+
1227
WORKDIR /app
1328

1429
RUN composer install

0 commit comments

Comments
 (0)