netlify / gotrue

An SWT based API for managing users and issuing SWT tokens.
https://www.gotrueapi.org
MIT License
3.82k stars 283 forks source link

cannot expose port from docker container after building image #290

Closed dnjooiopa closed 3 years ago

dnjooiopa commented 3 years ago

- Do you want to request a feature or report a bug? bug - What is the current behavior? can't connect api after building docker image assume it can't expose GOTRUE_API_PORT.

- If the current behavior is a bug, please provide the steps to reproduce.

- What is the expected behavior? it can expose GOTRUE_API_PORT

- Please mention your Go version, and operating system version. 1.13

Dockerfile

FROM golang:1.13-alpine as build
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=linux

RUN apk add --no-cache make git

WORKDIR /go/src/github.com/netlify/gotrue

COPY ./Makefile ./go.* ./
RUN make deps

COPY . /go/src/github.com/netlify/gotrue
RUN make build

FROM alpine:3.7
RUN adduser -D -u 1000 netlify

RUN apk add --no-cache ca-certificates
COPY --from=build /go/src/github.com/netlify/gotrue/gotrue /usr/local/bin/gotrue
COPY --from=build /go/src/github.com/netlify/gotrue/migrations /usr/local/etc/gotrue/migrations/

ENV GOTRUE_DB_MIGRATIONS_PATH /usr/local/etc/gotrue/migrations

USER netlify

CMD ["gotrue"]

ENV file

GOTRUE_JWT_SECRET="secret"
GOTRUE_JWT_EXP=3600
GOTRUE_JWT_AUD=api.myapi.com
GOTRUE_DB_DRIVER=mysql
DATABASE_URL="root:root@tcp(localhost:3306)/gotrue_db?parseTime=true&multiStatements=true"
GOTRUE_API_HOST=localhost
# GOTRUE_API_PORT=8081
GOTRUE_API_PORT=8081
GOTRUE_SITE_URL=localhost:8887
GOTRUE_LOG_LEVEL=DEBUG
GOTRUE_OPERATOR_TOKEN=super-secret-operator-token

GOTRUE_MAILER_AUTOCONFIRM=true
dnjooiopa commented 3 years ago

I run with command docker run -p 8081:8081 gotrue gotrue but I can't connect it with postman.