Skip to content

Commit

Permalink
#123 quickstart + Dockerfile (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
nh-37rtm authored Jun 28, 2024
1 parent 924000d commit d54c3f8
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 15 deletions.
37 changes: 29 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
# The MIT License (MIT) Copyright (c) 2022 artipie.com
# https://github.com/artipie/front/LICENSE.txt

FROM openjdk:21-oracle
ARG JAR_FILE
FROM openjdk:21-slim-bookworm as build

ENV JVM_OPTS=""

LABEL description="Artipie front service"
LABEL maintainer="[email protected]"

RUN groupadd -r -g 2020 artipie && \
adduser -M -r -g artipie -u 2021 -s /sbin/nologin artipie && \
mkdir -p /etc/artipie /usr/lib/web-service /var/artipie && \
# may optimize but require DOCKER_BUILDKIT=1
# RUN --mount=target=/var/lib/apt/lists,type=cache \
# --mount=target=/var/cache/apt,type=cache \
# --mount=target=/root/.m2,type=cache

RUN apt-get update

RUN apt-get install -y --no-install-recommends \
maven

# RUN useradd -ms /sbin/nologin artipie -g artipie -u 2021
COPY . /usr/local/src
WORKDIR /usr/local/src

RUN mvn clean install -Pqulice
RUN mvn dependency:copy-dependencies -DoutputDirectory=target/dependencies/

FROM openjdk:21-oracle as run

RUN groupadd -r -g 2020 artipie
RUN adduser -M -r -g artipie -u 2021 -s /sbin/nologin artipie
RUN mkdir -p /etc/artipie /usr/lib/web-service /var/artipie && \
chown artipie:artipie -R /etc/artipie /usr/lib/web-service /var/artipie
USER 2021:2020

COPY target/dependency /usr/lib/web-service/lib
COPY target/${JAR_FILE} /usr/lib/web-service/app.jar
USER artipie:artipie
ARG JAR_FILE=front-*-SNAPSHOT.jar

COPY --from=build /usr/local/src/target/dependencies/* /usr/lib/web-service/lib/
COPY --from=build /usr/local/src/target/${JAR_FILE} /usr/lib/web-service/app.jar

WORKDIR /var/web-service
HEALTHCHECK --interval=10s --timeout=3s \
Expand Down
42 changes: 35 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,45 @@ If you have any question or suggestions, do not hesitate to [create an issue](ht
[Telegram](https://t.me/artipie).
Artipie [roadmap](https://github.com/orgs/artipie/projects/3).

## Quick start

````
$ TAG=artipie-front
$ docker build . -t $TAG
$ docker run -p8080:8080 -eARTIPIE_REST=http://registry.local:8086 $TAG
````

## Build notes

### Building with maven

````
mvn clean install -Pqulice
````
(the qulice profile do not exists any more ?)

To avoid build errors use Maven 3.2+. (the 3.8 looks like working too)

### Export pom dependencies inside a folder

````
mvn dependency:copy-dependencies -DoutputDirectory=target/dependencies/
````

## Dockerfile notes

the Dockerfile use two layers, one build layer and the run layer (built with copying libraries from the build layer)

## Environment variables (not exhaustive list)

- ARTIPIE_REST : (default : http://localhost:8086) url to the artipie API (example : http://registry.local:8086),
- ARTIPIE_PORT : (default : 8080) port on which the server will listen to

## How to contribute

Please read [contributing rules](https://github.com/artipie/artipie/blob/master/CONTRIBUTING.md).

Fork repository, make changes, send us a pull request. We will review
your changes and apply them to the `master` branch shortly, provided
they don't violate our quality standards. To avoid frustration, before
sending us your pull request please run full Maven build:

```
$ mvn clean install -Pqulice
```

To avoid build errors use Maven 3.2+.
sending us your pull request please run full Maven build:

0 comments on commit d54c3f8

Please sign in to comment.