10000 feature: added docker sync, updated symfony to version 5.3 and make d… · ger86/symfony-docker@5916925 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5916925

Browse files
committed
feature: added docker sync, updated symfony to version 5.3 and make domain configurable
1 parent 3f969dc commit 5916925

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1415
-1208
lines changed

.devcontainer/devcontainer.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
2+
{
3+
"name": "Symfony Docker",
4+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
5+
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
6+
"dockerComposeFile": [
7+
"../.docker/docker-compose.yml"
8+
],
9+
// The 'service' property is the name of the service for the container that VS Code should
10+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
11+
"service": "php",
12+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
13+
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
14+
"workspaceFolder": "/var/www/symfony",
15+
"shutdownAction": "none",
16+
// Use 'settings' to set *default* container specific settings.json values on container create.
17+
// You can edit these settings after create using File > Preferences > Settings > Remote.
18+
"settings": {
19+
// This will ignore your local shell user setting for Linux since shells like zsh are typically
20+
// not in base container images. You can also update this to an specific shell to ensure VS Code
21+
// uses the right one for terminals and tasks. For example, /bin/bash (or /bin/ash for Alpine).
22+
"terminal.integrated.shell.linux": null
23+
},
24+
// Uncomment the next line to have VS Code connect as an existing non-root user in the container. See
25+
// https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist.
26+
// "remoteUser": "vscode",
27+
// Uncomment the next line if you want start specific services in your Docker Compose config.
28+
// "runServices": [],
29+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
30+
// "shutdownAction": "none",
31+
// Uncomment the next line to run commands after the container is created - for example installing git.
32+
// "postCreateCommand": "apt-get install git openssh",
33+
// Add the IDs of extensions you want installed when the container is created in the array below.
34+
"extensions": [
35+
"bmewburn.vscode-intelephense-client",
36+
"junstyle.php-cs-fixer",
37+
"editorconfig.editorconfig",
38+
"neilbrayfield.php-docblocker",
39+
"kaiwood.insert-cursor-at-beginning-of-each-line-selected",
40+
"mykhailokushnir.vscode-php-getter-setter",
41+
"syler.sass-indented"
42+
]
43+
}

.docker/.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
COMPOSE_PROJECT_NAME=symfony_docker
2+
MYSQL_ROOT_PASSWORD=hello
3+
MYSQL_DATABASE=app_db
4+
MYSQL_USER=app_user
5+
MYSQL_PASSWORD=helloworld
6+
7+
TIMEZONE=Europe/Madrid

.docker/.env.nginx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NGINX_BACKEND_DOMAIN=''

docker-compose.yml renamed to .docker/docker-compose.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: "3"
22

33
services:
44
db:
@@ -17,26 +17,28 @@ services:
1717
- symfony
1818
php:
1919
build:
20-
context: .
21-
dockerfile: docker/php/Dockerfile
20+
context: ./php
2221
args:
2322
TIMEZONE: ${TIMEZONE}
2423
volumes:
25-
- ./symfony/:/var/www/symfony/
24+
- symfony_docker_app_sync:/var/www/symfony/
2625
networks:
2726
- symfony
2827
nginx:
2928
build:
30-
context: .
31-
dockerfile: docker/nginx/Dockerfile
29+
context: ./nginx
3230
volumes:
33-
- ./symfony/:/var/www/symfony/
31+
- symfony_docker_app_sync:/var/www/symfony/
3432
ports:
3533
- 80:80
3634
networks:
3735
- symfony
36+
env_file:
37+
- .env.nginx.local
3838

3939
volumes:
40+
symfony_docker_app_sync:
41+
external: true
4042
db_app:
4143

4244
networks:

.docker/docker-sync.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: "2"
2+
3+
options:
4+
compose-file-path: "docker-compose.yml"
5+
verbose: true
6+
7+
syncs:
8+
symfony_docker_app_sync:
9+
src: "../"
10+
sync_userid: "33"
11+
sync_excludes:
12+
- ".docker"
13+
- ".git"
14+
- "var"
15+
- "vendor"
16+
watch_excludes:
17+
- ".docker"
18+
- ".git"
19+
- "var"
20+
- "vendor"

.docker/nginx/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM nginx:1.21-alpine
2+
3+
COPY nginx.conf /etc/nginx/
4+
COPY templates /etc/nginx/templates/
5+
RUN echo "upstream php-upstream { server php:9000; }" > /etc/nginx/conf.d/upstream.conf
6+
7+
EXPOSE 80
8+
EXPOSE 443
File renamed without changes.

docker/nginx/default.conf renamed to .docker/nginx/templates/default.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
server {
22
listen 80;
3-
server_name dev.symfony.com;
3+
server_name ${NGINX_BACKEND_DOMAIN};
44
root /var/www/symfony/public;
55

66
location / {

docker/php/Dockerfile renamed to .docker/php/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM php:7.4-fpm-buster
1+
FROM php:8.0-fpm-buster
22
ARG TIMEZONE
33

4-
COPY docker/php/php.ini /usr/local/etc/php/conf.d/docker-php-config.ini
4+
COPY php.ini /usr/local/etc/php/conf.d/docker-php-config.ini
55

66
RUN apt-get update && apt-get install -y \
77
gnupg \
File renamed without changes.

0 commit comments

Comments
 (0)
0