Skip to content

Commit

Permalink
Adjusted docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Jul 8, 2022
1 parent cb5e15f commit b0fdeaa
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 559 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
**/node_modules/
**/node
*.iml
.idea/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/target/
**/.DS_Store
**/node_modules/
.idea/
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# syntax=docker/dockerfile:1

### Dev Stage
FROM openmrs/openmrs-core:dev as dev
WORKDIR /app

ENV MVN_ARGS_SETTINGS="-s /usr/share/maven/ref/settings-docker.xml"
ENV MVN_ARGS="install"

# Copy build files
COPY pom.xml ./
COPY distro ./distro/

# Build the distro
RUN mvn $MVN_ARGS_SETTINGS $MVN_ARGS

### Run Stage
# Replace 'nightly' with the exact version of openmrs-core built for production (if available)
FROM openmrs/openmrs-core:nightly

# Do not copy the war if using the correct openmrs-core image version
COPY --from=dev /app/distro/target/sdk-distro/web/openmrs.war /openmrs/distribution/openmrs_core

COPY --from=dev /app/distro/target/sdk-distro/web/openmrs-distro.properties /openmrs/distribution

COPY --from=dev /app/distro/target/sdk-distro/web/modules /openmrs/distribution/openmrs_modules
COPY --from=dev /app/distro/target/sdk-distro/web/owa /openmrs/distribution/openmrs_owas
COPY --from=dev /app/distro/target/referenceapplication-distro/openmrs_config /openmrs/distribution/openmrs_config
25 changes: 0 additions & 25 deletions Dockerfile.build

This file was deleted.

11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@
#### Package the distribution and prepare the run

```
mvn clean package
docker-compose build
```

#### Run the app
```
cd run/docker
docker-compose up
```

New OpenMRS UI is accessible at http://localhost/openmrs/spa

OpenMRS Legacy UI is accessible at http://localhost/openmrs

---

## Notes

`package/` Package the OpenMRS distribution with the specified dependencies (omod, frontend modules, configurations...). See [package/README.md](distro/README.md) for more info.

`run/` Run the OpenMRS distribution. Currently, this only supports Docker. See [run/README.md](run/README.md) for more info.
30 changes: 0 additions & 30 deletions build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion distro/distro.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Ref 3.x distro
version=1.0
version=3.0.0
war.openmrs=${openmrs.version}
omod.initializer=${initializer.version}
omod.fhir2=${fhir2.version}
Expand Down
2 changes: 1 addition & 1 deletion distro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<appointments.version>1.4.0</appointments.version>
<cohort.version>3.0.0-SNAPSHOT</cohort.version>
<reporting.version>1.25.0-SNAPSHOT</reporting.version>
<reportingrest.version>1.13.0</reportingrest.version>
<reportingrest.version>1.14.0-SNAPSHOT</reportingrest.version>
<!-- the next three are required for reporting -->
<calculation.version>1.3.0</calculation.version>
<htmlwidgets.version>1.10.0</htmlwidgets.version>
Expand Down
15 changes: 4 additions & 11 deletions docker/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "3.7"

services:
# Gateway
gateway:
image: openmrs/openmrs-reference-application-3-gateway:${TAG:-nightly}
build:
context: ./gateway
depends_on:
Expand All @@ -11,26 +11,22 @@ services:
ports:
- 80:80

# Frontend
frontend:
image: openmrs/openmrs-reference-application-3-frontend:${TAG:-nightly}
build:
context: ./frontend
target: ${target:-base}
environment:
SPA_PATH: /openmrs/spa
API_URL: /openmrs
SPA_CONFIG_URLS:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
timeout: 5s
volumes:
- ./distro/spa:/usr/share/nginx/html/

# OpenMRS:
backend:
image: openmrs/openmrs-reference-application-3-backend:${TAG:-nightly}
build:
context: backend
target: ${target:-base}
context: .
depends_on:
- db
environment:
Expand All @@ -46,9 +42,6 @@ services:
timeout: 5s
volumes:
- openmrs-data:/openmrs/data
- ./distro/openmrs_core/:/openmrs/distribution/openmrs_core/
- ./distro/openmrs_modules:/openmrs/distribution/openmrs_modules/
- ./distro/openmrs_config:/openmrs/distribution/openmrs_config/

# MariaDB
db:
Expand Down
8 changes: 0 additions & 8 deletions docker/.env

This file was deleted.

1 change: 0 additions & 1 deletion docker/backend/.dockerignore

This file was deleted.

75 changes: 0 additions & 75 deletions docker/backend/Dockerfile

This file was deleted.

Loading

3 comments on commit b0fdeaa

@dkayiwa
Copy link
Member

Choose a reason for hiding this comment

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

@rkorytkowski could you be knowing why running docker-compose build on this 3.x branch results in this?

ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information. If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

@rkorytkowski
Copy link
Member Author

@rkorytkowski rkorytkowski commented on b0fdeaa Jul 12, 2022

Choose a reason for hiding this comment

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

@dkayiwa it's something with your docker installation. Could you please try upgrading docker and/or restarting sudo service docker restart?

@dkayiwa
Copy link
Member

Choose a reason for hiding this comment

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

A docker restart did the trick. Thanks @rkorytkowski 👍

Please sign in to comment.