Skip to content

Commit

Permalink
feat: dockerização do front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
Bessazs committed Dec 11, 2024
1 parent 1c2f3bc commit 438f5c8
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.next
**/.cache
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose.y*ml
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/build
**/dist
LICENSE
README.md
22 changes: 22 additions & 0 deletions README.Docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Building and running your application

When you're ready, start your application by running:
`docker compose up --build`.

Your application will be available at http://localhost:5173.

### Deploying your application to the cloud

First, build your image, e.g.: `docker build -t myapp .`.
If your cloud uses a different CPU architecture than your development
machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
you'll want to build the image for that platform, e.g.:
`docker build --platform=linux/amd64 -t myapp .`.

Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.

Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
docs for more detail on building and pushing.

### References
* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/)
Empty file removed app/static/css/style.css
Empty file.
Empty file removed app/views/html/index.html
Empty file.
15 changes: 15 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
server:
build:
context: ./frontend/vite-project
environment:
NODE_ENV: production
ports:
- 5173:5173
develop:
watch:
- path: ./frontend/vite-project/package.json
action: rebuild
- path: ./frontend/vite-project
target: /usr/src/app
action: sync
22 changes: 22 additions & 0 deletions frontend/vite-project/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dockerfile

# Use uma imagem base do Node.js
FROM node:18

# Defina o diretório de trabalho no contêiner
WORKDIR /usr/src/app

# Copie os arquivos do package.json e package-lock.json
COPY package*.json ./

# Instale as dependências do projeto
RUN npm install

# Copie o restante do projeto para o diretório de trabalho
COPY . .

# Exponha a porta padrão do Vite (geralmente é 5173)
EXPOSE 5173

# Comando padrão para iniciar o Vite
CMD npm run dev -- --host
2 changes: 1 addition & 1 deletion frontend/vite-project/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function App() {
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
Click on the Vite and React to learn more
</p>
</>
)
Expand Down

0 comments on commit 438f5c8

Please sign in to comment.