Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker compose rework #256

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
build/
18 changes: 18 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.19-alpine

RUN mkdir -p /app

WORKDIR /app/github.com/cryptag/leapchat/miniware

WORKDIR /app/github.com/cryptag/leapchat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimmcgaw I believe we want the 3 lines above into these 2, so that our working directory exists and so we don't have the additional WORKDIR:

RUN mkdir -p /app/github.com/cryptag/leapchat/miniware
WORKDIR /app/github.com/cryptag/leapchat

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I think this PR is ready to merge! Is it working well for you locally?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah there needs to be a bit more done: https://github.com/cryptag/leapchat/milestone/7


COPY miniware/* miniware/
elimisteve marked this conversation as resolved.
Show resolved Hide resolved
COPY *.go .
COPY go.* .
COPY LICENSE.md .

RUN go build

EXPOSE 8080

CMD ["./leapchat"]
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

shell:
docker compose exec app /bin/sh

elimisteve marked this conversation as resolved.
Show resolved Hide resolved
start:
docker compose up -d

stop:
docker compose down

restart:
docker compose restart

build:
docker compose build

buildup:
docker compose up -d --build

cleanv:
docker compose down -v
26 changes: 23 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
version: '3.1'
version: '3.4'

services:
app:
build:
context: .
dockerfile: ./Dockerfile.dev
ports:
- 8080:8080
depends_on:
- postgrest
elimisteve marked this conversation as resolved.
Show resolved Hide resolved
volumes:
- ./build:/app/github.com/cryptag/leapchat/build
postgres:
image: postgres:latest
ports:
- 127.0.0.1:5432:5432
- 5433:5432
environment:
- POSTGRES_PASSWORD=superuser
- POSTGRES_USER=superuser
- POSTGRES_DB=leapchat
volumes:
- ./_docker-volumes/postgres:/var/lib/postgresql/data
#- ./db:/docker-entrypoint-initdb.d/
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 5s
timeout: 60s
retries: 10
postgrest:
command: postgrest /app/postgrest.conf
image: postgrest/postgrest:latest
ports:
- 3000:3000
Expand All @@ -23,5 +40,8 @@ services:
PGDATABASE: leapchat
elimisteve marked this conversation as resolved.
Show resolved Hide resolved
PGSCHEMA: public
DB_ANON_ROLE: postgres
volumes:
- ./db/:/app
depends_on:
- postgres
postgres:
condition: service_healthy
6 changes: 3 additions & 3 deletions leapchat.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ func init() {
}

func main() {
httpAddr := flag.String("http", "127.0.0.1:8080",
httpAddr := flag.String("http", "0.0.0.0:8080",
elimisteve marked this conversation as resolved.
Show resolved Hide resolved
"Address to listen on HTTP")
httpsAddr := flag.String("https", "127.0.0.1:8443",
httpsAddr := flag.String("https", "0.0.0.0:8443",
"Address to listen on HTTPS")
domain := flag.String("domain", "", "Domain of this service")
iframeOrigin := flag.String("iframe-origin", "",
Expand All @@ -38,7 +38,7 @@ func main() {
flag.Parse()

if *onionPush {
*httpAddr = "127.0.0.1:5001"
*httpAddr = "0.0.0.0:5001"
BUILD_DIR = "public"
}

Expand Down