Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
update docker
Browse files Browse the repository at this point in the history
  • Loading branch information
hexahigh committed Feb 29, 2024
1 parent 98c79e7 commit d1bbcd0
Show file tree
Hide file tree
Showing 5 changed files with 308 additions and 7 deletions.
17 changes: 13 additions & 4 deletions backend/dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
FROM alpine:3.19

COPY --from=golang:1.22-alpine /usr/local/go/ /usr/local/go/

ENV PATH="/usr/local/go/bin:${PATH}"

RUN apk add --no-cache \
git \
gcc \
musl-dev
musl-dev \
wget \
bash

RUN git clone https://github.com/hexahigh/yapc.git /source
RUN git clone https://github.com/hexahigh/yapc.git /source && \
cd /source && \
git checkout main && \
git pull

WORKDIR /source/backend

ENV CGO_ENABLED=1
RUN go build -o server ./main.go

# Download the wait-for-it.sh script
RUN wget -O /wait-for-it.sh https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && \
chmod +x /wait-for-it.sh

RUN mv ./server /server
WORKDIR /
RUN rm -rf /source

ENTRYPOINT [ "/server", "-d", "/data", "-db:file", "/data/yapc.db" ]
ENTRYPOINT [ "bash", "/wait-for-it.sh", "mysql:3306", "-t", "60", "--", "/server", "-d", "/data", "-db:file", "/data/yapc.db" ]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
backend:
image: hexahigh/yapc
ports:
- "8088:8080" # Backend port
- "9090:8080" # Backend port
volumes:
- ./data:/data
environment:
Expand Down
12 changes: 10 additions & 2 deletions frontend/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ FROM node:21-alpine3.19
RUN apk add --no-cache \
git

RUN git clone https://github.com/hexahigh/yapc.git /source
RUN git clone https://github.com/hexahigh/yapc.git /source && \
cd /source && \
git checkout main && \
git pull

WORKDIR /source/frontend

RUN sed -i 's/adapter-auto/adapter-node/g' svelte.config.js

RUN cat svelte.config.js

RUN npm install

ENTRYPOINT [ "npm", "run", "build" ]
ENV PORT=3009
ENTRYPOINT npm run build && node build
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@catppuccin/tailwindcss": "^0.1.6",
"@formkit/auto-animate": "^0.8.1",
"@sveltejs/adapter-cloudflare": "^3.0.1",
"@sveltejs/adapter-node": "^4.0.1",
"axios": "^1.6.5",
"mime": "^4.0.1",
"pretty-bytes": "^6.1.1",
Expand Down
Loading

0 comments on commit d1bbcd0

Please sign in to comment.