mirror of
https://github.com/thomiceli/opengist.git
synced 2025-01-03 16:22:40 +00:00
Add Dockerfile
This commit is contained in:
parent
b48f15690a
commit
c3940933bb
4 changed files with 59 additions and 2 deletions
7
.dockerignore
Normal file
7
.dockerignore
Normal file
|
@ -0,0 +1,7 @@
|
|||
node_modules/
|
||||
gist.db
|
||||
.idea/
|
||||
.DS_Store
|
||||
/**/.DS_Store
|
||||
public/assets/*
|
||||
public/manifest.json
|
43
Dockerfile
Normal file
43
Dockerfile
Normal file
|
@ -0,0 +1,43 @@
|
|||
FROM alpine:3.17
|
||||
|
||||
# Install required dependencies
|
||||
RUN apk update && \
|
||||
apk add --no-cache \
|
||||
openssl \
|
||||
openssh \
|
||||
curl \
|
||||
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:16-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 . .
|
||||
|
||||
# Build the application
|
||||
RUN make
|
||||
|
||||
# Expose the port for the webserver
|
||||
EXPOSE 6157
|
||||
|
||||
# Mount the .opengist volume
|
||||
VOLUME /root/.opengist
|
||||
|
||||
# Run the webserver
|
||||
CMD ["./opengist"]
|
9
Makefile
9
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: all install_deps build_frontend build_backend clean
|
||||
.PHONY: all install_deps build_frontend build_backend build_docker clean clean_docker
|
||||
|
||||
# Specify the name of your Go binary output
|
||||
BINARY_NAME := opengist
|
||||
|
@ -19,8 +19,15 @@ build_backend:
|
|||
@echo "Building Opengist binary..."
|
||||
go build -o $(BINARY_NAME) opengist.go
|
||||
|
||||
build_docker:
|
||||
@echo "Building Docker image..."
|
||||
docker build -t opengist .
|
||||
|
||||
clean:
|
||||
@echo "Cleaning up build artifacts..."
|
||||
@rm -f $(BINARY_NAME) public/manifest.json
|
||||
@rm -rf node_modules public/assets
|
||||
|
||||
clean_docker:
|
||||
@echo "Cleaning up Docker image..."
|
||||
@docker rmi opengist
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
|||
module opengist
|
||||
|
||||
go 1.18
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/go-playground/validator/v10 v10.11.0
|
||||
|
|
Loading…
Reference in a new issue