Skip to content

Commit

Permalink
move to /src in containers to mimic local tree
Browse files Browse the repository at this point in the history
  • Loading branch information
kenichi authored and KentShikama committed Apr 9, 2020
1 parent a4ef86e commit e638837
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: copy to pipenv project dir
run: cp -R src/backend/* /var/opt/backend && ls -l /var/opt/backend
run: cp -R src/backend/* /src/backend && ls -l /src/backend

- name: add pg client
run: apk add postgresql-client
Expand All @@ -52,4 +52,4 @@ jobs:
run: psql -v ON_ERROR_STOP=1 -f config/postgres/initdb/scripts/initial_credentials.dev.sql

- name: run backend tests
run: cd /var/opt/backend && pipenv run mypy && pipenv run pytest
run: cd /src/backend && pipenv run mypy && pipenv run pytest
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ backend_test:
docker-compose exec expungeservice pipenv run pytest

frontend_test:
docker-compose exec node sh -c 'cd /var/opt/frontend && npm test'
docker-compose exec node sh -c 'cd /src/frontend && npm test'

frontend_test_no_watch:
docker-compose exec node sh -c 'cd /var/opt/frontend && CI=true npm test'
docker-compose exec node sh -c 'cd /src/frontend && CI=true npm test'
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ services:
- config/postgres/client.env
image: recordsponge/expungeservice:dev
volumes:
- ./src/backend:/var/opt/backend
- ./src/frontend:/var/opt/frontend
- ./src/backend:/src/backend
- ./src/frontend:/src/frontend
ports:
- "5000:5000"

node:
command: sh -c "cd /var/opt/frontend && npm install && npm start"
command: sh -c "cd /src/frontend && npm install && npm start"
depends_on:
- expungeservice
image: node:alpine
ports:
- "3000:3000"
volumes:
- ./src/frontend:/var/opt/frontend
- node_modules:/var/opt/frontend/node_modules
- ./src/frontend:/src/frontend
- node_modules:/src/frontend/node_modules

volumes:
node_modules:
Expand Down
12 changes: 6 additions & 6 deletions src/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ LABEL authors="Kenichi Nakamura <[email protected]>"
RUN pip install pipenv
RUN apk update

RUN mkdir -p /var/opt/backend/expungeservice
WORKDIR /var/opt/backend
RUN mkdir -p /src/backend/expungeservice
WORKDIR /src/backend

ENV WORKON_HOME=/var/opt/venvs
ENV WORKON_HOME=/src/venvs
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

Expand All @@ -19,14 +19,14 @@ FROM base AS build

RUN apk add build-base git libffi-dev openssl-dev postgresql-dev

COPY Pipfile* setup.py /var/opt/backend/
RUN cd /var/opt/backend && pipenv install
COPY Pipfile* setup.py /src/backend/
RUN cd /src/backend && pipenv install

# ---

FROM base

COPY --from=build /var/opt/venvs /var/opt/venvs
COPY --from=build /src/venvs /src/venvs

EXPOSE 5000
CMD ["pipenv", "run", "uwsgi", "--py-autoreload", "1", "--http", "0.0.0.0:5000", "--module", "expungeservice.wsgi", "--die-on-term", "--uid", "nobody"]

0 comments on commit e638837

Please sign in to comment.