Skip to content

Commit

Permalink
Merge pull request #1135 from willcohen/podman
Browse files Browse the repository at this point in the history
* Add podman support alongside docker for dev
* Consolidate client build steps into a single Dockerfile, which may help with heroku deploy
  • Loading branch information
metasoarous authored Nov 4, 2021
2 parents 8010acf + cf6c58e commit ba4b289
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:latest
FROM docker.io/alpine:latest

ENV BUILD_DEPS="bash build-base libpng-dev zlib-dev autoconf automake libtool nasm curl" \
RUN_DEPS="openssh-client openjdk8-jre"
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
46 changes: 10 additions & 36 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,45 +74,19 @@ 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
depends_on:
- "client-participation"
- "client-admin"
- "client-report"
context: ./
dockerfile: file-server/Dockerfile
args:
GIT_HASH: "${GIT_HASH}"
networks:
- "polis-net"
ports:
- "8080:8080"

client-participation:
container_name: polis-client-participation
image: 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}
build:
context: ./client-admin
args:
GIT_HASH: "${GIT_HASH}"

client-report:
container_name: polis-client-report
image: 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
88 changes: 77 additions & 11 deletions file-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,90 @@
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
# polis-client-admin
# Gulp v3 stops us from upgrading beyond Node v11
FROM docker.io/node:11.15.0-alpine

FROM node:16.9.0-alpine
WORKDIR /client-admin/app

WORKDIR /app
RUN apk add git --no-cache

COPY package*.json ./
COPY client-admin/package*.json ./
RUN npm install

COPY client-admin/polis.config.template.js polis.config.js
# If polis.config.js exists on host, will override template here.
COPY client-admin/. .

ARG GIT_HASH
RUN npm run deploy:prod

# polis-client-participation
# # Gulp v3 stops us from upgrading beyond Node v11
FROM docker.io/node:11.15.0-alpine

WORKDIR ../../client-participation/app

RUN apk add --no-cache --virtual .build \
g++ git make python

# Allow global npm installs in Docker
RUN npm config set unsafe-perm true

# Upgrade npm v6.7.0 -> v6.9.2 to alias multiple pkg versions.
# See: https://stackoverflow.com/a/56134858/504018
RUN npm install -g [email protected]

COPY client-participation/package*.json ./

RUN npm ci

RUN apk del .build

COPY client-participation/polis.config.template.js polis.config.js
# If polis.config.js exists on host, will override template here.
COPY client-participation/. .

ARG GIT_HASH
ARG BABEL_ENV=production

RUN npm run deploy:prod


# polis-client-report
# Gulp v3 stops us from upgrading beyond Node v11
FROM docker.io/node:11.15.0-alpine

WORKDIR ../../client-report/app

RUN apk add git --no-cache

COPY client-report/package*.json ./
RUN npm ci

COPY client-report/polis.config.template.js polis.config.js
# If polis.config.js exists on host, will override template here.
COPY client-report/. .

ARG GIT_HASH
RUN npm run deploy:prod


FROM docker.io/node:16.9.0-alpine

WORKDIR ../../file-server/app

COPY file-server/package*.json ./

RUN npm ci

COPY . .
COPY fs_config.template.json fs_config.json
COPY file-server/. .
COPY file-server/fs_config.template.json fs_config.json

RUN mkdir /app
RUN mkdir /app/build
COPY --from=admin /app/build/ /app/build
COPY --from=participation /app/build/ /app/build
COPY --from=report /app/build/ /app/build
COPY --from=0 /client-admin/app/build/ /app/build
COPY --from=1 /client-participation/app/build/ /app/build
COPY --from=2 /client-report/app/build/ /app/build

EXPOSE 8080

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.3-alpine
FROM docker.io/nginx:1.21.3-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.4-alpine
FROM docker.io/postgres:13.4-alpine

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

0 comments on commit ba4b289

Please sign in to comment.