diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..05e1c45 --- /dev/null +++ b/compose.yml @@ -0,0 +1,63 @@ +services: + godash: + profiles: [build] + build: + context: . + dockerfile: ./docker/Dockerfile + args: + - GOLANG_VERSION=${GOLANG_VERSION} + - NODE_VERSION=${NODE_VERSION} + - ALPINE_VERSION=${ALPINE_VERSION} + + backend: + build: + context: . + dockerfile_inline: | + ARG GOLANG_VERSION + FROM golang:${GOLANG_VERSION}-alpine + RUN apk add tzdata + WORKDIR /app + COPY ./go.mod . + COPY ./go.sum . + RUN go mod download + RUN go install github.com/cosmtrek/air@latest + COPY ./.air.toml . + args: + - GOLANG_VERSION=${GOLANG_VERSION} + command: air -c .air.toml + environment: + - TZ=Europe/Berlin + - LOG_LEVEL=debug + - TITLE=DEV + - APP_VERSION=v0.0.1-dev + - BUILD_TIME=2023-04-05T20:48:07Z + ports: + - 4000:4000 + volumes: + - ./:/app/ + + frontend: + build: + context: . + dockerfile_inline: | + ARG NODE_VERSION + FROM node:${NODE_VERSION}-alpine + WORKDIR /app/web + COPY ./web/package.json . + COPY ./web/yarn.lock . + RUN yarn install --frozen-lockfile + args: + - NODE_VERSION=${NODE_VERSION} + container_name: frontend + command: yarn run tailwind:dev + tty: true + volumes: + - .:/app + + yarn: + profiles: [install] + image: node:${NODE_VERSION}-alpine + working_dir: /app/web + entrypoint: yarn + volumes: + - .:/app diff --git a/docker/Dockerfile b/docker/Dockerfile index fe0b2cb..4456deb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,7 +12,7 @@ COPY . . RUN go build -ldflags="-s -w" cmd/godash/godash.go FROM node:${NODE_VERSION}-alpine AS nodeBuilder -WORKDIR /app +WORKDIR /web COPY ./internal/router/templates.go /internal/router/templates.go COPY ./web . diff --git a/scripts/dev.sh b/scripts/dev.sh index c577fc6..7de6c98 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -17,9 +17,6 @@ parse_yaml() { eval $(parse_yaml .gitlab/_common.gitlab-ci.yml) -echo "DOCKER_VERSION="$variables_DOCKER_VERSION >.env -echo "GOLANG_VERSION="$variables_GOLANG_VERSION >>.env +echo "GOLANG_VERSION="$variables_GOLANG_VERSION >.env echo "NODE_VERSION="$variables_NODE_VERSION >>.env echo "ALPINE_VERSION="$variables_ALPINE_VERSION >>.env -echo "DEBIAN_VERSION="$variables_DEBIAN_VERSION >>.env -echo "TELEPORT_VERSION="$variables_TELEPORT_VERSION >>.env