Improve Dockerfile, docker build CI, Readme

This commit is contained in:
Thomas Miceli
2023-04-10 22:52:52 +02:00
parent 611d677404
commit 7452617aa7
3 changed files with 251 additions and 22 deletions

View File

@ -1,6 +1,28 @@
FROM alpine:3.17 AS build
RUN apk update && \
apk add --no-cache \
make \
gcc \
musl-dev \
libstdc++
COPY --from=golang:1.19-alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"
COPY --from=node:18-alpine /usr/local/ /usr/local/
ENV NODE_PATH="/usr/local/lib/node_modules"
ENV PATH="/usr/local/bin:${PATH}"
WORKDIR /opengist
COPY . .
RUN make
FROM alpine:3.17
# Install required dependencies
RUN apk update && \
apk add --no-cache \
openssl \
@ -9,35 +31,15 @@ RUN apk update && \
wget \
git \
gnupg \
make \
xz \
gcc \
musl-dev \
libstdc++
# Install Golang
COPY --from=golang:1.19-alpine /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"
# Install Node.js
COPY --from=node:18-alpine /usr/local/ /usr/local/
ENV NODE_PATH="/usr/local/lib/node_modules"
ENV PATH="/usr/local/bin:${PATH}"
# Set the working directory
WORKDIR /opengist
# Copy all source files
COPY . .
COPY --from=build /opengist/opengist .
# Build the application
RUN make
# Expose the ports
EXPOSE 6157 2222
# Mount the .opengist volume
VOLUME /root/.opengist
# Run the webserver
CMD ["./opengist"]