Skip to content

Commit

Permalink
Add podman support alongside docker for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
willcohen committed Sep 2, 2021
1 parent a2a9a85 commit c03cb3c
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 20 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,45 @@ If you would like to run docker compose as a background process, run the `up` co
And to stop:
`docker-compose down`

### Running docker-compose with podman on MacOS

Note: these instructions are work-in-progress and should be considered an alternative for MacOS users who have performance issues when using Docker Desktop.

Install podman using homebrew:

`brew install podman`
`podman machine init`
`podman machine start`

Use podman to determine how to connect to the running virtual machine:

`podman system connection ls`

``` sh
Name Identity URI
podman-machine-default* /Users/username/.ssh/podman-machine-default ssh://core@localhost:54821/run/user/1000/podman/podman.sock
```

Create a tunnel with a temporary socket using that information:

`ssh -nNT -L $(pwd)/docker.sock:/run/user/1000/podman/podman.sock core@localhost -p 54821 -i ~/.ssh/podman-machine-default`


Configure docker-compose to use this temporary socket:

`export DOCKER_HOST=unix://$(pwd)/docker.sock`
`export COMPOSE_DOCKER_CLI_BUILD=0`

From there, docker-compose can be used as mentioned above:

`docker-compose pull`

To expose ports locally, ssh tunnels can forward ports from Vagrant:

`ssh -CL 5000:localhost:5000 -N v`

This will expose the running polis instance on `http://localhost:5000/home`.

### check your ip (only necessary on docker-machine):
```
docker-machine ip
Expand Down
2 changes: 1 addition & 1 deletion client-admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Gulp v3 stops us from upgrading beyond Node v11
FROM node:11.15.0-alpine
FROM docker.io/node:11.15.0-alpine

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion client-participation/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Gulp v3 stops us from upgrading beyond Node v11
FROM node:11.15.0-alpine
FROM docker.io/node:11.15.0-alpine

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion client-report/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Gulp v3 stops us from upgrading beyond Node v11
FROM node:11.15.0-alpine
FROM docker.io/node:11.15.0-alpine

WORKDIR /app

Expand Down
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
server:
container_name: polis-server
env_file: ./server/docker-dev.env
image: compdem/polis-server:${TAG}
image: docker.io/compdem/polis-server:${TAG}
build:
context: ./server
dockerfile: Dockerfile
Expand All @@ -34,7 +34,7 @@ services:
math:
container_name: polis-math
env_file: ./math/docker-dev.env
image: compdem/polis-math:${TAG}
image: docker.io/compdem/polis-math:${TAG}
depends_on:
- "postgres"
build:
Expand All @@ -45,7 +45,7 @@ services:
postgres:
container_name: polis-postgres
env_file: ./server/docker-db-dev.env
image: compdem/polis-postgres:${TAG}
image: docker.io/compdem/polis-postgres:${TAG}
restart: always
build:
context: ./server
Expand All @@ -58,7 +58,7 @@ services:

nginx-proxy:
container_name: polis-nginx-proxy
image: compdem/polis-nginx-proxy:${TAG}
image: docker.io/compdem/polis-nginx-proxy:${TAG}
build:
context: ./file-server
dockerfile: nginx.Dockerfile
Expand All @@ -74,7 +74,7 @@ services:

file-server:
container_name: polis-file-server
image: compdem/polis-file-server:${TAG}
image: docker.io/compdem/polis-file-server:${TAG}
build:
context: ./file-server
dockerfile: Dockerfile
Expand All @@ -89,30 +89,30 @@ services:

client-participation:
container_name: polis-client-participation
image: compdem/polis-client-participation:${TAG}
image: docker.io/compdem/polis-client-participation:${TAG}
build:
context: ./client-participation
args:
GIT_HASH: "${GIT_HASH}"

client-admin:
container_name: polis-client-admin
image: compdem/polis-client-admin:${TAG}
image: docker.io/compdem/polis-client-admin:${TAG}
build:
context: ./client-admin
args:
GIT_HASH: "${GIT_HASH}"

client-report:
container_name: polis-client-report
image: compdem/polis-client-report:${TAG}
image: docker.io/compdem/polis-client-report:${TAG}
build:
context: ./client-report
args:
GIT_HASH: "${GIT_HASH}"

maildev:
image: maildev/maildev:1.1.0
image: docker.io/maildev/maildev:1.1.0
networks:
- "polis-net"
ports:
Expand Down
8 changes: 4 additions & 4 deletions file-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG TAG=dev

FROM compdem/polis-client-admin:${TAG} as admin
FROM compdem/polis-client-participation:${TAG} as participation
FROM compdem/polis-client-report:${TAG} as report
FROM docker.io/compdem/polis-client-admin:${TAG} as admin
FROM docker.io/compdem/polis-client-participation:${TAG} as participation
FROM docker.io/compdem/polis-client-report:${TAG} as report

FROM node:16.6.1-alpine
FROM docker.io/node:16.6.1-alpine

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion file-server/nginx.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1.21.1-alpine
FROM docker.io/nginx:1.21.1-alpine

COPY nginx/nginx-ssl.site.default.conf /etc/nginx/conf.d/default.conf

Expand Down
2 changes: 1 addition & 1 deletion math/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM clojure:tools-deps
FROM docker.io/clojure:tools-deps

WORKDIR /app
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.14.0-alpine
FROM docker.io/node:14.14.0-alpine

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion server/Dockerfile-db
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM postgres:13.3-alpine
FROM docker.io/postgres:13.3-alpine

# Used when no existing database on postgres volume, including first initialization.
# See: docs/deployment.md#database-migrations
Expand Down

0 comments on commit c03cb3c

Please sign in to comment.