Skip to content

Commit

Permalink
DV-000303: Add map location real time.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaskocuturilo committed Aug 20, 2024
1 parent 3034974 commit a90ac65
Show file tree
Hide file tree
Showing 7 changed files with 3,936 additions and 29 deletions.
47 changes: 33 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
# Stage 1: Build
FROM gradle:7.4.2-jdk-alpine AS TEMP_BUILD_IMAGE

RUN apk add --no-cache bash
RUN echo "@personal http://dl-cdn.alpinelinux.org/alpine/v3.15/main" >> /etc/apk/repositories
RUN apk add nodejs@personal npm@personal
RUN node --version
RUN npm --version
# Install dependencies in a single layer
RUN apk add --no-cache bash \
&& echo "@personal https://dl-cdn.alpinelinux.org/alpine/v3.9/main" >> /etc/apk/repositories \
&& apk add --no-cache nodejs@personal npm@personal \
&& node --version \
&& npm --version

ENV APP_HOME=/usr/app/
# Set the working directory
WORKDIR /usr/app/

WORKDIR $APP_HOME
COPY build.gradle settings.gradle $APP_HOME
# Copy only necessary files for dependency resolution and building
COPY build.gradle settings.gradle ./
COPY gradle ./gradle

COPY gradle $APP_HOME/gradle/
COPY --chown=gradle:gradle . /home/gradle/src
# Ensure Gradle runs as non-root user
RUN chown -R gradle:gradle ./

COPY . .
USER gradle

# Build the application, skipping tests for faster builds
ARG REACT_APP_TOKEN
ENV REACT_APP_TOKEN $REACT_APP_TOKEN

RUN gradle clean npm_run_build copyTask build -x test --no-daemon || return 0

FROM eclipse-temurin:17-jdk-alpine
# Stage 2: Package
FROM eclipse-temurin:21-jdk-alpine

# Add curl (if needed) in a single command to minimize layers
RUN apk --no-cache add curl

# Define environment variables
ENV ARTIFACT_NAME=simpleRegions-0.0.1-SNAPSHOT.jar
ENV APP_HOME=/usr/app

COPY --from=TEMP_BUILD_IMAGE $APP_HOME/build/libs/$ARTIFACT_NAME app.jar
# Set the working directory
WORKDIR $APP_HOME

# Copy the built artifact from the build stage
COPY --from=TEMP_BUILD_IMAGE /usr/app/build/libs/$ARTIFACT_NAME app.jar

# Use a non-root user to run the application
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser

# Expose the application's port
EXPOSE 8080

ENTRYPOINT ["java", "-jar","-Dspring.profiles.active=docker", "/app.jar"]
# Set the entry point to run the jar
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=docker", "/app.jar"]
6 changes: 6 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
npm-debug.log
.DS_Store
.git
.gitignore
.env
26 changes: 13 additions & 13 deletions frontend/src/components/MapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import icon from "./constants";

function MapView() {

const defaultCenter = [52.237049, 21.017532];
const defaultZoom = 13;
const mapRef = useRef();
const defaultCenter = [52.237049, 21.017532];
const defaultZoom = 13;
const mapRef = useRef();

return (
<MapContainer ref={mapRef} center={defaultCenter} zoom={defaultZoom} scrollWheelZoom={false}>
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>
<Marker position={defaultCenter} icon={icon}>
<Popup>
A pretty CSS3 popup. <br /> Easily customizable.
</Popup>
</Marker>
</MapContainer>
<MapContainer ref={mapRef} center={defaultCenter} zoom={defaultZoom} scrollWheelZoom={false}>
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"/>

<Marker position={defaultCenter} icon={icon}>
<Popup>
A pretty CSS3 popup. <br /> Easily customizable.
</Popup>
</Marker>
</MapContainer>

);
}

Expand Down
Binary file added frontend/src/img/map_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a90ac65

Please sign in to comment.