Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix: docker expose env error (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan authored Nov 21, 2022
1 parent b1ac940 commit 0703f82
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Dev Image
on:
push:
branches:
- 'release/1.9.1'
- 'dev'

jobs:
docker:
Expand All @@ -23,6 +23,6 @@ jobs:
uses: docker/build-push-action@v3
with:
push: true
tags: eolinker/eoapi-remote-server:1.9.1
tags: eolinker/eoapi-remote-server:dev
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ FROM node:lts-alpine as builder

ENV PROJECT_DIR=/eoapi-remote-server \
MYSQL_HOST=mysql \
MYSQL_PORT=3306
MYSQL_PORT=3306 \
EOAPI_SERVER_PORT=3000

# WORKDIR指令用于设置Dockerfile中的RUN、CMD和ENTRYPOINT指令执行命令的工作目录(默认为/目录),该指令在Dockerfile文件中可以出现多次,
# 如果使用相对路径则为相对于WORKDIR上一次的值,
Expand Down Expand Up @@ -40,7 +41,7 @@ RUN chmod +x ./wait-for-it.sh \
# RUN yarn cache clean

# 容器对外暴露的端口号
EXPOSE 3000
EXPOSE $EOAPI_SERVER_PORT

# 容器启动时执行的命令,类似npm run start
# CMD ["yarn", "start:prod"]
Expand Down
8 changes: 6 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
eoapi-remote-server:
# build: 从当前路径构建镜像
# build: .
image: eolinker/eoapi-remote-server:latest
image: eolinker/eoapi-remote-server:dev
container_name: eoapi-remote-server
deploy:
restart_policy:
Expand All @@ -15,7 +15,7 @@ services:
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${EOAPI_SERVER_PORT}:3000'
- '${EOAPI_SERVER_PORT}:${EOAPI_SERVER_PORT}'
networks:
- eoapi_net

Expand Down Expand Up @@ -45,6 +45,8 @@ services:
max_attempts: 3
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:
- .env
ports:
- '${EOAPI_WEB_SERVER_POST}:80'
# volumes:
Expand All @@ -59,6 +61,8 @@ services:
restart_policy:
condition: on-failure
max_attempts: 3
env_file:
- .env
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
Expand Down

0 comments on commit 0703f82

Please sign in to comment.