Skip to content

Commit

Permalink
improve mysql container support (sqlc-dev#1711)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakobera authored and jlisthood committed Apr 28, 2023
1 parent 9cc7a6d commit fbf85f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster
ARG VARIANT=1.17-bullseye
ARG VARIANT=1.18-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}

# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
Expand Down
10 changes: 7 additions & 3 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ services:
context: ..
dockerfile: .devcontainer/Dockerfile
args:
VARIANT: 1.17-bullseye
VARIANT: 1.18-bullseye

volumes:
- ..:/workspace:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

links:
- mysql
- postgresql

environment:
PG_HOST: postgresql
PG_USER: postgres
Expand All @@ -24,13 +28,14 @@ services:
MYSQL_ROOT_PASSWORD: mysecretpassword

mysql:
image: "mysql:8"
image: "mysql/mysql-server:8.0"
ports:
- "3306:3306"
restart: unless-stopped
environment:
MYSQL_DATABASE: dinotest
MYSQL_ROOT_PASSWORD: mysecretpassword
MYSQL_ROOT_HOST: '%'

postgresql:
image: "postgres:13"
Expand All @@ -41,6 +46,5 @@ services:
POSTGRES_DB: dinotest
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_USER: postgres

# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
version: "3.8"
services:
mysql:
image: "mysql:8"
image: "mysql/mysql-server:8.0"
ports:
- "3306:3306"
restart: always
environment:
MYSQL_DATABASE: dinotest
MYSQL_ROOT_PASSWORD: mysecretpassword
MYSQL_ROOT_HOST: '%'

postgresql:
image: "postgres:13"
Expand Down

0 comments on commit fbf85f5

Please sign in to comment.