Skip to content

Instantly share code, notes, and snippets.

@joaobispo2077
Created May 2, 2022 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaobispo2077/3a159f45a7c5cb022e8942eb9fa0e677 to your computer and use it in GitHub Desktop.
Save joaobispo2077/3a159f45a7c5cb022e8942eb9fa0e677 to your computer and use it in GitHub Desktop.
Dockerfile with build proxy and set proxy into container of an api.
version: '3'
services:
api:
build:
context: .
dockerfile: Dockerfile
args:
http_proxy: "http://xxx.xx.xx.xxx:3128"
https_proxy: "http://xxx.xx.xx.xxx:3128"
all_proxy: "http://xxx.xx.xx.xxx:3128"
ALL_PROXY: "http://xxx.xx.xx.xxx:3128"
container_name: api
environment:
- https_proxy=http://xxx.xx.xx.xxx:3128
- all_proxy=http://xxx.xx.xx.xxx:3128
- ALL_PROXY=http://xxx.xx.xx.xxx:3128
- HTTPS_PROXY=http://xxx.xx.xx.xxx:3128
- HTTP_PROXY=http://xxx.xx.xx.xxx:3128
- PORT=3333
ports:
- '3333:3333'
working_dir: /opt/api
links:
- database
depends_on:
- database
command: npm run start:dev
database:
container_name: database
image: mysql:8.0.28
hostname: mysql
environment:
MYSQL_DATABASE: ${DATABASE_SCHEMA}
MYSQL_USER: ${DATABASE_USER}
# MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
MYSQL_PASSWORD: ${DATABASE_PASSWORD}
ports:
- "${DATABASE_PORT}:${DATABASE_PORT}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment