Skip to content

Commit a228123

Browse files
committed
Refactor Dockerfile to build GoTTY from source in a separate stage
1 parent 4cb0c6a commit a228123

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Build stage for GoTTY
2+
FROM golang:alpine AS gotty-builder
3+
4+
# Install git for go install to fetch the repository
5+
RUN apk add --no-cache git
6+
7+
# Install GoTTY from source
8+
RUN go install github.com/sorenisanerd/[email protected]
9+
10+
# Final stage
111
FROM alpine:3.18.6
212

313
EXPOSE 22 80 443 1180 11443 8080
@@ -47,11 +57,9 @@ COPY nginx.conf /etc/nginx/nginx.conf
4757
COPY .bashrc /root/.bashrc
4858
RUN echo 'if [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.bash_profile
4959

50-
# Install GoTTY binary only - NOT starting it automatically
51-
RUN wget -q -O /tmp/gotty.tar.gz https://github.com/sorenisanerd/gotty/releases/download/v1.5.0/gotty_v1.5.0_linux_amd64.tar.gz && \
52-
tar -zxf /tmp/gotty.tar.gz -C /usr/local/bin && \
53-
rm /tmp/gotty.tar.gz && \
54-
chmod +x /usr/local/bin/gotty
60+
# Copy GoTTY binary from the build stage
61+
COPY --from=gotty-builder /go/bin/gotty /usr/local/bin/
62+
RUN chmod +x /usr/local/bin/gotty
5563

5664
# Create directories for GoTTY service
5765
RUN mkdir -p /var/run/gotty /var/log/gotty

0 commit comments

Comments
 (0)