Skip to content

Commit

Permalink
Resolve: Commented Solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaushl2208 committed Jun 5, 2024
1 parent 8c1fa00 commit 0796180
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
19 changes: 12 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,23 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -o laas ./cmd/laas
# Release Stage
FROM alpine:3.20 AS build-release

COPY entrypoint.sh /entrypoint.sh
WORKDIR /app

RUN apk add --no-cache openssl bash \
&& chmod +x /entrypoint.sh
COPY entrypoint.sh /app/entrypoint.sh

WORKDIR /data
RUN apk add --no-cache openssl bash \
&& addgroup -S noroot \
&& adduser -S noroot -G noroot

COPY --from=build /LicenseDb/licenseRef.json /data/licenseRef.json
COPY --from=build /LicenseDb/laas /laas
COPY --from=build /LicenseDb/licenseRef.json /app/licenseRef.json
COPY --from=build /LicenseDb/laas /app/laas

EXPOSE 8080

RUN chmod +rx /app/entrypoint.sh \
&& touch /app/.env \
&& chown --recursive noroot:noroot /app

USER noroot:noroot

ENTRYPOINT [ "/entrypoint.sh" ]
ENTRYPOINT [ "/app/entrypoint.sh" ]
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
services:
licensedb:
container_name: licensedb
build:
build:
context: .
environment:
DB_PASSWORD: fossy
Expand All @@ -28,8 +28,8 @@ services:
POSTGRES_PASSWORD: fossy
POSTGRES_USER: fossy
POSTGRES_DB: fossology
ports:
- "5432:5432"
# ports:
# - "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
restart: always
Expand All @@ -42,6 +42,6 @@ services:
- licensedb-network
networks:
licensedb-network:
driver: bridge
driver: bridge
volumes:
pgdata:
9 changes: 5 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ db_name="${DB_NAME:-fossology}"
db_user="${DB_USER:-fossy}"
db_password="${DB_PASSWORD:-fossy}"
populate_db="${POPULATE_DB:-true}"
data_file="/data/licenseRef.json"
data_file="/app/licenseRef.json"

printf "TOKEN_HOUR_LIFESPAN=24\nAPI_SECRET=%s\n" $(openssl rand -hex 32) > .env
printf "TOKEN_HOUR_LIFESPAN=24\nAPI_SECRET=%s\n" $(openssl rand -hex 32) > /app/.env

/app/laas -host=$db_host -port=$db_port -user=$db_user -dbname=$db_name \
-password=$db_password -datafile="$data_file" -populatedb=$populate_db

/laas -host=$db_host -port=$db_port -user=$db_user -dbname=$db_name \
-password=$db_password -datafile="$data_file" -populatedb=$populate_db

0 comments on commit 0796180

Please sign in to comment.