Skip to content

Commit

Permalink
Add packy
Browse files Browse the repository at this point in the history
  • Loading branch information
Laica-Lunasys committed Jul 15, 2024
1 parent 07e0199 commit 623e953
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
40 changes: 27 additions & 13 deletions plain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
FROM docker.io/alpine:latest AS download_velocity
WORKDIR /velocity
FROM docker.io/alpine:latest AS download_assets

ARG VELOCITY_VERSION=3.1.1
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH

RUN apk add --no-cache curl jq
COPY utils/velocity.sh /velocity/

# Download tools
WORKDIR /tmp
RUN wget -O packy.tar.gz https://github.com/synchthia/packy/releases/latest/download/packy_${TARGETOS}_${TARGETARCH}.tar.gz && \
tar -xvzf ./packy.tar.gz && \
wget -O yq https://github.com/mikefarah/yq/releases/latest/download/yq_${TARGETOS}_${TARGETARCH} && \
chmod +x yq

# Download velocity
WORKDIR /velocity
RUN sh /velocity/velocity.sh ${VELOCITY_VERSION}

# ---
# ---
FROM docker.io/eclipse-temurin:17-alpine
FROM docker.io/eclipse-temurin:21
EXPOSE 25565
ENV LANG en_US.UTF-8
ENV LANG=en_US.UTF-8

# Config
ENV ONLINE_MODE true
ENV PORT 25565
ENV ONLINE_MODE=true
ENV PORT=25565

# Install assets
COPY --from=download_assets /tmp/packy /tmp/yq /usr/local/bin/

# Install velocity
COPY --from=download_velocity /velocity/velocity.jar /velocity/
COPY --from=download_assets /velocity/velocity.jar /velocity/

# Setup user
RUN chmod u+s /bin/* && \
apk --no-cache add su-exec shadow yq
RUN apt-get update -qq && \
apt-get install -y gosu && \
apt-get clean

# Copy Entry point
COPY entrypoint.sh launcher.sh autoconfig.sh /

RUN addgroup -g 1000 app && \
adduser app -u 1000 -S -G app
RUN addgroup --gid 1000 app && \
useradd app --uid 1000 -g app -s /bin/bash

# Copy basements...
COPY templates/ /app/templates/
Expand All @@ -43,4 +57,4 @@ RUN mkdir -p \

WORKDIR /app/server

CMD ["sh", "/entrypoint.sh"]
CMD ["bash", "/entrypoint.sh"]
2 changes: 1 addition & 1 deletion plain/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ if [ $(id -u) = 0 ]; then
fi

chown ${UID:-app}:${GID:-app} -R /app/
exec su-exec ${UID:-app} sh /launcher.sh start
exec gosu ${UID:-app} bash /launcher.sh start
8 changes: 8 additions & 0 deletions plain/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ _task_prepare() {
done
}

_fetch() {
if [ "$USE_PACKY" ]; then
packy fetch -s "velocity" -d /app/plugins
fi
}

_template

_fetch
}

## start - start server
Expand Down

0 comments on commit 623e953

Please sign in to comment.